22 lines
436 B
PHP
22 lines
436 B
PHP
<?php
|
|
|
|
namespace App\Actions\Page;
|
|
|
|
use App\Events\ModelChanged;
|
|
use App\Models\Page;
|
|
use App\Repositories\Contracts\PageRepositoryInterface;
|
|
|
|
final class DeletePageAction
|
|
{
|
|
public function __construct(private PageRepositoryInterface $repository) {}
|
|
|
|
public function execute(Page $page): bool
|
|
{
|
|
$this->repository->delete($page);
|
|
|
|
ModelChanged::dispatch(Page::class, 'deleted');
|
|
|
|
return true;
|
|
}
|
|
}
|