From cafd92568fc1a0259ea372e46b9c2f4fc13e90aa Mon Sep 17 00:00:00 2001 From: liapples Date: Sat, 13 Nov 2021 23:33:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BA=A7=E5=93=81=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=88=A0=E9=99=A4=E4=BB=A3=E7=90=86=E5=95=86=E4=BA=A7?= =?UTF-8?q?=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Product.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Models/Product.php b/app/Models/Product.php index 647bae1..f9447dd 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -41,6 +41,11 @@ class Product extends BaseModel ProductSaved::dispatch($product); } }); + + # 删除产品同步删除代理商产品 + static::deleted(function ($product) { + AgentProduct::query()->where('product_id', $product->id)->delete(); + }); } // 获取所有产品图片