103 lines
2.4 KiB
PHP
103 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Auth;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class RegisterPostRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'first_name' => [
|
|
'required',
|
|
'string',
|
|
'min:3',
|
|
'max:150',
|
|
'persian_alpha',
|
|
|
|
],
|
|
'last_name' => [
|
|
'required',
|
|
'string',
|
|
'min:3',
|
|
'max:150',
|
|
'persian_alpha',
|
|
],
|
|
'email' => [
|
|
'required',
|
|
'email',
|
|
'min:10',
|
|
'max:150',
|
|
'unique:users,email'
|
|
],
|
|
|
|
'password' => [
|
|
'required',
|
|
'string',
|
|
'min:8',
|
|
'alpha_num',
|
|
'confirmed:password'
|
|
|
|
],
|
|
'mobile' => [
|
|
'required',
|
|
'string',
|
|
'digits:11',
|
|
'unique:users,mobile',
|
|
'ir_mobile:zero'
|
|
],
|
|
'user_name' => [
|
|
'required' ,
|
|
'string',
|
|
'min:5',
|
|
'max:100',
|
|
'alpha_num'
|
|
],
|
|
'national_code' => [
|
|
'required',
|
|
'digits:10',
|
|
'unique:users,national_code',
|
|
'ir_national_id'
|
|
],
|
|
'spouse_name' => [
|
|
'nullable',
|
|
'string',
|
|
'min:3',
|
|
'max:100',
|
|
'persian_alpha'
|
|
],
|
|
'gender' => [
|
|
'required',
|
|
'int',
|
|
'in:0,1,2'
|
|
],
|
|
'marital_status' => [
|
|
'required',
|
|
'int',
|
|
'in:0,1'
|
|
],
|
|
'user_province' => [
|
|
'nullable'
|
|
],
|
|
'user_city' => [
|
|
'nullable'
|
|
]
|
|
];
|
|
}
|
|
}
|