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

@@ -3,6 +3,8 @@
namespace App\Jobs\Setting;
use App\Abstracts\Job;
use App\Events\Setting\CategoryDeleted;
use App\Events\Setting\CategoryDeleting;
use App\Exceptions\Settings\LastCategoryDelete;
use App\Interfaces\Job\ShouldDelete;
use App\Models\Setting\Category;
@@ -13,10 +15,14 @@ class DeleteCategory extends Job implements ShouldDelete
{
$this->authorize();
event(new CategoryDeleting($this->model));
\DB::transaction(function () {
$this->model->delete();
});
event(new CategoryDeleted($this->model));
return true;
}