From b7127d66782c7585e020e105e8a2f2f71807880e Mon Sep 17 00:00:00 2001 From: Watheq Alshowaiter Date: Fri, 23 Aug 2024 20:38:45 +0300 Subject: [PATCH] feat: return foreign key for sons table --- .../2024_07_13_100247_create_sons_table.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/database/migrations/2024_07_13_100247_create_sons_table.php b/database/migrations/2024_07_13_100247_create_sons_table.php index a7e5925..0595a18 100644 --- a/database/migrations/2024_07_13_100247_create_sons_table.php +++ b/database/migrations/2024_07_13_100247_create_sons_table.php @@ -13,11 +13,14 @@ public function up(): void Schema::create('sons', function (Blueprint $table) { $table->bigIncrements('id'); - if((float) App::version() >= Constants::VERSION_AFTER_FOREIGN_ID_SUPPORT){ - $table->foreignId('father_id'); - }else { - $table->unsignedBigInteger('father_id'); - } + $table->unsignedBigInteger('father_id'); + $table->foreign('father_id')->references('id')->on('fathers'); + // + //if((float) App::version() >= Constants::VERSION_AFTER_FOREIGN_ID_SUPPORT){ + // $table->foreignId('father_id'); + //}else { + // $table->unsignedBigInteger('father_id'); + //} }); }