From 29c1af045e4cf44f39ed349c61dcab0161c3cee2 Mon Sep 17 00:00:00 2001 From: musta20 Date: Mon, 2 Dec 2024 04:50:27 +0200 Subject: [PATCH 1/2] add json defult value --- .../2024_01_25_100443_create_stores_table.php | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/database/migrations/2024_01_25_100443_create_stores_table.php b/database/migrations/2024_01_25_100443_create_stores_table.php index a661646f..211fe228 100644 --- a/database/migrations/2024_01_25_100443_create_stores_table.php +++ b/database/migrations/2024_01_25_100443_create_stores_table.php @@ -11,7 +11,20 @@ { public function up(): void { + Schema::create('stores', function (Blueprint $table) { + $socialMedia = [ + SocialMedia::FACEBOOK->value => '', + SocialMedia::X->value => '', + SocialMedia::INSTAGRAM->value => '', + SocialMedia::WHATSAPP->value => '', + SocialMedia::SNAPCHAT->value => '', + SocialMedia::YOUTUBE->value => '', + SocialMedia::TIKTOK->value => '', + SocialMedia::TELEGRAM->value => '', + + ]; + $table->ulid('id')->primary(); $table->string('title'); $table->string('logo')->nullable(); @@ -39,21 +52,7 @@ public function up(): void $table->string('phone')->nullable(); $table->string('specialty')->nullable(); - $table->json('SocialMedia')->default( - json_encode( - [ - SocialMedia::FACEBOOK->value => '', - SocialMedia::X->value => '', - SocialMedia::INSTAGRAM->value => '', - SocialMedia::WHATSAPP->value => '', - SocialMedia::SNAPCHAT->value => '', - SocialMedia::YOUTUBE->value => '', - SocialMedia::TIKTOK->value => '', - SocialMedia::TELEGRAM->value => '', - - ] - ) - ); + $table->json('SocialMedia')->default($socialMedia); $table->foreignUlid('user_id') ->index() From 012a950ba7cbd2df499cd638da369f56e4424526 Mon Sep 17 00:00:00 2001 From: musta20 Date: Mon, 2 Dec 2024 02:51:02 +0000 Subject: [PATCH 2/2] Dusting --- database/migrations/2024_01_25_100443_create_stores_table.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2024_01_25_100443_create_stores_table.php b/database/migrations/2024_01_25_100443_create_stores_table.php index 211fe228..6e497cbc 100644 --- a/database/migrations/2024_01_25_100443_create_stores_table.php +++ b/database/migrations/2024_01_25_100443_create_stores_table.php @@ -23,8 +23,8 @@ public function up(): void SocialMedia::TIKTOK->value => '', SocialMedia::TELEGRAM->value => '', - ]; - + ]; + $table->ulid('id')->primary(); $table->string('title'); $table->string('logo')->nullable();