mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 18:52:10 +00:00
38 lines
927 B
PHP
38 lines
927 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Models\Player;
|
|
use App\Models\Room;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateRoomPermissionsRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
$room = $this->route('room');
|
|
$player = $this->attributes->get('currentPlayer');
|
|
|
|
return $room instanceof Room
|
|
&& $player instanceof Player
|
|
&& $player->room_id === $room->id
|
|
&& $player->is_moderator;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'allow_participant_controls' => ['required', 'boolean:strict'],
|
|
];
|
|
}
|
|
}
|