43 lines
1.0 KiB
PHP
43 lines
1.0 KiB
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Http\Requests\Game;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
|
||
|
|
class TrainRequest 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 [
|
||
|
|
'stat' => ['required', 'string', 'in:strength,defense,speed,dexterity'],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get custom messages for validator errors.
|
||
|
|
*
|
||
|
|
* @return array<string, string>
|
||
|
|
*/
|
||
|
|
public function messages(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'stat.required' => 'You must select a stat to train.',
|
||
|
|
'stat.string' => 'The stat must be a string.',
|
||
|
|
'stat.in' => 'The selected stat is invalid. Valid stats are: strength, defense, speed, dexterity.',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|