Files
DADProject/api/app/Http/Requests/StoreGameRequest.php
T
2025-12-12 00:05:37 +00:00

33 lines
792 B
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreGameRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'variant' => 'required|in:bisca-3,bisca-9',
'mode' => 'required|in:single-player,multiplayer',
'opponent_id' => $this->mode === 'multiplayer'
? 'required|exists:users,id'
: 'nullable',
];
}
}