plan implementation 6, 7, 8, 9, 10
This commit is contained in:
46
app/Http/Requests/Screening/UpdateScreeningRequest.php
Normal file
46
app/Http/Requests/Screening/UpdateScreeningRequest.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Screening;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
final class UpdateScreeningRequest 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 [
|
||||
'answers' => ['required', 'array', 'size:10'],
|
||||
'answers.*' => ['required', 'string', 'in:yes,no'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom validation messages.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'answers.required' => 'All screening questions must be answered.',
|
||||
'answers.array' => 'Answers must be provided as an array.',
|
||||
'answers.size' => 'All 10 screening questions must be answered.',
|
||||
'answers.*.required' => 'Each screening question must have an answer.',
|
||||
'answers.*.string' => 'Each answer must be a valid text value.',
|
||||
'answers.*.in' => 'Each answer must be either "yes" or "no".',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user