mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 14:52:09 +00:00
35 lines
871 B
PHP
35 lines
871 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Requests\KickRoomPlayerRequest;
|
|
use App\Models\Player;
|
|
use App\Models\Room;
|
|
use App\Models\User;
|
|
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
|
|
{
|
|
$user = $request->user();
|
|
|
|
abort_unless($user instanceof User, 403);
|
|
|
|
$this->roomParticipation->kick($room, $player, $user);
|
|
|
|
Inertia::flash('toast', [
|
|
'type' => 'success',
|
|
'message' => "{$player->name} wurde aus dem Raum entfernt.",
|
|
]);
|
|
|
|
return back();
|
|
}
|
|
}
|