mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 15:32:09 +00:00
36 lines
819 B
PHP
36 lines
819 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Models\Player;
|
|
use App\Models\Room;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class KickRoomPlayerRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
$room = $this->route('room');
|
|
$player = $this->route('player');
|
|
|
|
return $room instanceof Room
|
|
&& $player instanceof Player
|
|
&& $this->user()?->id === $room->owner_id
|
|
&& $player->room_id === $room->id
|
|
&& $player->user_id !== $room->owner_id;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, array<int, string>>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [];
|
|
}
|
|
}
|