update deploy
This commit is contained in:
24
app/Actions/Comment/UpdateCommentAction.php
Normal file
24
app/Actions/Comment/UpdateCommentAction.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user