Files
bogazici-api/app/Actions/Comment/DeleteCommentAction.php
2026-03-27 10:41:54 +03:00

22 lines
463 B
PHP

<?php
namespace App\Actions\Comment;
use App\Events\ModelChanged;
use App\Models\Comment;
use App\Repositories\Contracts\CommentRepositoryInterface;
final class DeleteCommentAction
{
public function __construct(private CommentRepositoryInterface $repository) {}
public function execute(Comment $comment): bool
{
$this->repository->delete($comment);
ModelChanged::dispatch(Comment::class, 'deleted');
return true;
}
}