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