'required|string|max:200|regex:/^[a-zA-Z. ]+$/', 'address' => 'sometimes|nullable|string|max:200', 'email' => 'sometimes|nullable|email', 'subject' => 'sometimes|nullable|string|max:1000', 'message' => 'required|string|max:1000', 'phone' => ['sometimes','nullable','regex:/^\+?\d{7,15}$/'], ]; } public function messages() { return [ '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 200 characters.', 'full_name.regex' => 'The full name may only contain letters, dots, and spaces.', 'address.string' => 'The address must be a string.', 'address.max' => 'The address may not be greater than 200 characters.', 'email.email' => 'Invalid email format.', 'subject.string' => 'The subject must be a string.', 'subject.max' => 'The subject may not be greater than 1000 characters.', 'message.required' => 'The message field is required.', 'message.string' => 'The message must be a string.', 'message.max' => 'The message may not be greater than 1000 characters.', 'phone.numeric' => 'The phone must be a number.', 'phone.digits_between' => 'The phone must be a number between 7 and 15 digits long.', ]; } /** * Determine if the user is authorized to make this request. */ public function authorize(): bool { return true; } }