From b7c6751cb7749ade9921f892451af666db4d4410 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Sun, 12 Jan 2025 03:58:09 +0330 Subject: [PATCH] fixed bug props remove error [safe remove] --- app/Http/Controllers/Admin/PropController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/Admin/PropController.php b/app/Http/Controllers/Admin/PropController.php index 1955339..151da59 100644 --- a/app/Http/Controllers/Admin/PropController.php +++ b/app/Http/Controllers/Admin/PropController.php @@ -7,6 +7,7 @@ use App\Http\Controllers\XController; use App\Http\Requests\PropSaveRequest; use App\Models\Access; use App\Models\Category; +use App\Models\Product; use App\Models\Prop; use Illuminate\Http\Request; use App\Helper; @@ -123,6 +124,9 @@ class PropController extends XController public function destroy(Prop $item) { + foreach (Product::whereHasMeta($item->name)->get() as $product){ + $product->removeMeta($item->name); + } return parent::delete($item); }