update deploy
This commit is contained in:
22
app/Actions/Comment/CreateCommentAction.php
Normal file
22
app/Actions/Comment/CreateCommentAction.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Comment;
|
||||
|
||||
use App\DTOs\CommentData;
|
||||
use App\Events\ModelChanged;
|
||||
use App\Models\Comment;
|
||||
use App\Repositories\Contracts\CommentRepositoryInterface;
|
||||
|
||||
final class CreateCommentAction
|
||||
{
|
||||
public function __construct(private CommentRepositoryInterface $repository) {}
|
||||
|
||||
public function execute(CommentData $data): Comment
|
||||
{
|
||||
$result = $this->repository->create($data->toArray());
|
||||
|
||||
ModelChanged::dispatch(Comment::class, 'created');
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user