mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 19:52:09 +00:00
allow anyone controll room option
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user