63 lines
1.4 KiB
PHP
63 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Users;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class UserEditRequest 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' => [
|
|
'nullable',
|
|
'min:2',
|
|
'max:100',
|
|
'persian_alpha',
|
|
],
|
|
|
|
'last_name' => [
|
|
'nullable',
|
|
'min:3',
|
|
'max:100',
|
|
'persian_alpha',
|
|
],
|
|
|
|
'email' => [
|
|
'nullable',
|
|
'max:150',
|
|
'email',
|
|
Rule::unique('users', 'email')->ignore($this->route('user'))
|
|
],
|
|
|
|
'mobile' => [
|
|
'nullable',
|
|
'ir_mobile:zero',
|
|
Rule::unique('users', 'mobile')->ignore($this->route('user'))
|
|
],
|
|
'password' => [
|
|
'nullable',
|
|
'string',
|
|
'min:6',
|
|
'max:255',
|
|
]
|
|
|
|
];
|
|
}
|
|
}
|