-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [LAR-28] add reply form to create and update reply to thread
- Loading branch information
1 parent
e2e14c8
commit dfd59e0
Showing
40 changed files
with
603 additions
and
638 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Actions\Forum; | ||
|
||
use App\Contracts\ReplyInterface; | ||
use App\Events\ReplyWasCreated; | ||
use App\Gamify\Points\ReplyCreated; | ||
use App\Models\Reply; | ||
use App\Models\User; | ||
use Illuminate\Support\Facades\Auth; | ||
|
||
final class CreateReplyAction | ||
{ | ||
public function execute(string $body, ReplyInterface $model): void | ||
{ | ||
/** @var User $user */ | ||
$user = Auth::user(); | ||
|
||
$reply = new Reply(['body' => $body]); | ||
$reply->authoredBy($user); | ||
$reply->to($model); | ||
$reply->save(); | ||
|
||
givePoint(new ReplyCreated($model, $user)); | ||
event(new ReplyWasCreated($reply)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.