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

57 lines
1.8 KiB
PHP

<?php
namespace Modules\Appointment\app\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CreateAppointmentRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'team_member_id' => 'required|integer',
'full_name' => 'required|string|max:150',
'email' => 'required|email',
'contact_no' => ['required','nullable','regex:/^\+?\d{7,15}$/'],
'subject' => 'required|string|max:500',
'feedback' => 'required|string',
];
}
public function messages()
{
return [
'team_member_id.required' => 'The team member field is required.',
'team_member_id.integer' => 'The team member must be an integer.',
'full_name.required' => 'The full name field is required.',
'full_name.string' => 'The full name must be a string.',
'full_name.max' => 'The full name may not be greater than 150 characters.',
'email.required' => 'The email field is required.',
'email.email' => 'Invalid email format.',
'contact_no.required' => 'The contact number field is required.',
'contact_no.regex' => 'The contact number must be a valid phone number',
'subject.required' => 'The subject field is required.',
'subject.string' => 'The subject must be a string.',
'subject.max' => 'The subject may not be greater than 500 characters.',
'feedback.required' => 'The feedback field is required.',
'feedback.string' => 'The feedback must be a string.',
];
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
}