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

25 lines
558 B
PHP

<?php
namespace App\Actions\Comment;
use App\Events\ModelChanged;
use App\Models\Comment;
use App\Repositories\Contracts\CommentRepositoryInterface;
final class UpdateCommentAction
{
public function __construct(private CommentRepositoryInterface $repository) {}
/**
* @param array<string, mixed> $data
*/
public function execute(Comment $comment, array $data): Comment
{
$result = $this->repository->update($comment, $data);
ModelChanged::dispatch(Comment::class, 'updated');
return $result;
}
}