From 6b1d289506621bf3dbb116a085a4b61a2c2a6651 Mon Sep 17 00:00:00 2001 From: Jonathan Nielson Date: Sun, 4 Aug 2024 12:35:22 -0500 Subject: [PATCH] Fix: Make the slug of an Article unique --- database/migrations/2024_02_05_014414_create_articles_table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2024_02_05_014414_create_articles_table.php b/database/migrations/2024_02_05_014414_create_articles_table.php index 5b81d37..ca55f4b 100644 --- a/database/migrations/2024_02_05_014414_create_articles_table.php +++ b/database/migrations/2024_02_05_014414_create_articles_table.php @@ -18,7 +18,7 @@ return new class extends Migration // The URL-encoded version of the title, more or less. Also acts as // the unique, public-facing identifier for the article - $table->string('slug', 255); + $table->string('slug', 255)->unique(); $table->foreignId('author_id') ->constrained(table: 'authors', indexName: 'articles_authors_id')