Files
freeu-project/app/Http/Requests/StoreAssetManagerRegistrationRequest.php

60 lines
2.3 KiB
PHP
Raw Normal View History

2024-03-28 14:52:40 +05:30
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreAssetManagerRegistrationRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name2' => 'required|regex:/^[a-zA-Z\s]+$/',
'authorized_representative_name' => 'required|regex:/^[a-zA-Z\s]+$/',
'email2' => 'required|unique:users,email|regex:/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/',
'password2' =>'required|min:8|regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\x])(?=.*[!$#%@]).*$/',
'password_confirmation' => 'same:password2',
'contact_number2' => 'required|unique:users,contact_number|min:10|max:12|regex:/^(\+\d{1,3}[- ]?)?\d{10,12}$/',
'g-recaptcha-response' => 'sometimes|required',
];
}
public function messages()
{
return [
'name2.required' => 'The name field is required.',
'email2.required' => 'The email field is required.',
'password2.required' => 'The password field is required.',
'contact_number2.required' => 'The contact number field is required.',
'email2.unique' => 'The email field is unique.',
'contact_number2.unique' => 'The contact number field is unique.',
];
// return [
// 'contact_number.min' => 'Contact Number should be minimum 10 numbers',
// 'contact_number.max' => 'Contact Number should be maximum 12 numbers',
// 'contact_number.regex' => "Mobile number should be number not alphabets",
// 'password.regex' => 'Password does not follow regex',
// 'password.min' => 'Password should be minimum 8 characters',
// 'password.confirmed' => 'Password Confirmation Does Not Match Password',
// 'unique' => 'The :attribute field should be unique.',
// 'required' => 'The :attribute field is required.',
// 'name.regex' => 'The :attribute field contain only alphabets',
// ];
}
}