mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 20:32:09 +00:00
35 lines
866 B
PHP
35 lines
866 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Requests\KickRoomPlayerRequest;
|
|
use App\Models\Player;
|
|
use App\Models\Room;
|
|
use App\Services\Rooms\RoomParticipationService;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Inertia\Inertia;
|
|
|
|
class RoomPlayerKickController extends Controller
|
|
{
|
|
public function __construct(
|
|
private readonly RoomParticipationService $roomParticipation,
|
|
) {}
|
|
|
|
public function __invoke(KickRoomPlayerRequest $request, Room $room, Player $player): RedirectResponse
|
|
{
|
|
$this->roomParticipation->kick(
|
|
$room,
|
|
$player,
|
|
$request->user(),
|
|
$request->currentPlayer($room),
|
|
);
|
|
|
|
Inertia::flash('toast', [
|
|
'type' => 'success',
|
|
'message' => "{$player->name} wurde aus dem Raum entfernt.",
|
|
]);
|
|
|
|
return back();
|
|
}
|
|
}
|