mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 18:12:09 +00:00
Add room participant moderation
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?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 [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user