22 lines
466 B
PHP
22 lines
466 B
PHP
<?php
|
|
|
|
namespace App\Actions\Category;
|
|
|
|
use App\Events\ModelChanged;
|
|
use App\Models\Category;
|
|
use App\Repositories\Contracts\CategoryRepositoryInterface;
|
|
|
|
class DeleteCategoryAction
|
|
{
|
|
public function __construct(private CategoryRepositoryInterface $repository) {}
|
|
|
|
public function execute(Category $category): bool
|
|
{
|
|
$this->repository->delete($category);
|
|
|
|
ModelChanged::dispatch(Category::class, 'deleted');
|
|
|
|
return true;
|
|
}
|
|
}
|