close #2799 Fixed: Company delete can not delete sub categories

This commit is contained in:
Cüneyt Şentürk
2022-12-07 11:43:38 +03:00
parent cba5dd519c
commit 86a44fb3e5
13 changed files with 186 additions and 28 deletions

View File

@@ -1,26 +0,0 @@
<?php
namespace App\Observers;
use App\Abstracts\Observer;
use App\Jobs\Setting\DeleteCategory;
use App\Models\Setting\Category as Model;
use App\Traits\Jobs;
class Category extends Observer
{
use Jobs;
/**
* Listen to the deleted event.
*
* @param Model $category
* @return void
*/
public function deleting(Model $category)
{
foreach ($category->sub_categories as $sub_category) {
$this->dispatch(new DeleteCategory($sub_category));
}
}
}