mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 16:32:09 +00:00
35 lines
821 B
PHP
35 lines
821 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Requests\ThrowPaperBallRequest;
|
|
use App\Models\Player;
|
|
use App\Models\Room;
|
|
use App\Services\Rooms\RoomEmoteService;
|
|
use Illuminate\Http\Response;
|
|
|
|
class RoomEmoteController extends Controller
|
|
{
|
|
public function __construct(
|
|
private readonly RoomEmoteService $roomEmotes,
|
|
) {}
|
|
|
|
public function store(ThrowPaperBallRequest $request, Room $room): Response
|
|
{
|
|
$player = $request->attributes->get('currentPlayer');
|
|
|
|
abort_unless(
|
|
$player instanceof Player && $player->room_id === $room->id,
|
|
403,
|
|
);
|
|
|
|
$this->roomEmotes->throwPaperBall(
|
|
$room,
|
|
$player,
|
|
(int) $request->validated('target_player_id'),
|
|
);
|
|
|
|
return response()->noContent();
|
|
}
|
|
}
|