42 lines
938 B
PHP
42 lines
938 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Game;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class AttemptCrimeRequest 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 [
|
|
'crime_id' => ['required', 'exists:crimes,id'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom messages for validator errors.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'crime_id.required' => 'You must select a crime to attempt.',
|
|
'crime_id.exists' => 'The selected crime does not exist.',
|
|
];
|
|
}
|
|
}
|