From 981086e1f630babb4950144adf7c32e1d8308c69 Mon Sep 17 00:00:00 2001 From: OhmygoodR <109280933+OhmygoodR@users.noreply.github.com> Date: Mon, 6 Nov 2023 18:03:33 +0800 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..9a22e739 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(); });