firstcommit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ContactUs\app\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CreateContactUsRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'full_name' => '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|numeric|digits:10',
|
||||
];
|
||||
}
|
||||
|
||||
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' => 'The phone must be exactly 10 digits long.'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user