From d3919e6f6e9ad883bdb82c26d22e6bb3a908cc32 Mon Sep 17 00:00:00 2001 From: hmdee <32852463+hmdee@users.noreply.github.com> Date: Fri, 8 Nov 2024 02:00:35 +0200 Subject: [PATCH] Update 2021_11_09_082205_create_products_table.php --- .../task4/2021_11_09_082205_create_products_table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/task4/2021_11_09_082205_create_products_table.php b/database/migrations/task4/2021_11_09_082205_create_products_table.php index 78636019..6253f189 100644 --- a/database/migrations/task4/2021_11_09_082205_create_products_table.php +++ b/database/migrations/task4/2021_11_09_082205_create_products_table.php @@ -16,7 +16,7 @@ public function up() // TASK: Edit this file, so that deleting category would auto-delete its products Schema::create('products', function (Blueprint $table) { $table->id(); - $table->foreignId('category_id')->constrained(); + $table->foreignId('category_id')->constrained()->cascadeOnDelete(); $table->string('name'); $table->timestamps(); });