Files
aroginhealthcare/Modules/Consultation/app/Http/Requests/CreateConsultationRequest.php
2025-08-21 16:04:24 +05:45

68 lines
2.6 KiB
PHP

<?php
namespace Modules\Consultation\app\Http\Requests;
use Modules\Consultation\app\Helpers\Options;
use Illuminate\Foundation\Http\FormRequest;
class CreateConsultationRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'name' => 'required|string|max:200|regex:/^[a-zA-Z. ]+$/',
'email' => 'sometimes|nullable|email|max:255',
'contact_no' => 'required|string|max:20',
'age_group' => 'required|integer|between:1,7',
'procedure_of_interest' => 'required|integer|between:1,5',
'subject' => 'required|string|max:255',
'message' => 'required|string',
'is_aggrement' => 'required|in:10,11',
];
}
public function messages()
{
return [
'name.required' => 'The name field is required.',
'name.string' => 'The name field must be a string.',
'name.max' => 'The name may not be greater than :max characters.',
'name.regex' => 'The name field may only contain letters, spaces, and dots.',
'email.email' => 'The email must be a valid email address.',
'email.max' => 'The email may not be greater than :max characters.',
'contact_no.required' => 'The contact number field is required.',
'contact_no.regex' => 'The contact number must be a valid phone number',
'age_group.required' => 'The age group field is required.',
'age_group.integer' => 'The age group must be an integer.',
'age_group.between' => 'The age group must be between :min and :max.',
'procedure_of_interest.required' => 'The procedure of interest field is required.',
'procedure_of_interest.integer' => 'The procedure of interest must be an integer.',
'procedure_of_interest.between' => 'The procedure of interest must be between :min and :max.',
'subject.required' => 'The subject field is required.',
'subject.string' => 'The subject field must be a string.',
'subject.max' => 'The subject may not be greater than :max characters.',
'message.required' => 'The message field is required.',
'is_aggrement.required' => 'The agreement field is required.',
'is_aggrement.in' => 'Invalid value for the agreement field.',
];
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
}