70 lines
1.6 KiB
PHP
70 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class EditProfilePostRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'first_name' => [
|
|
'required',
|
|
'persian_alpha',
|
|
'min:2',
|
|
'max:100',
|
|
],
|
|
|
|
'last_name' => [
|
|
'required',
|
|
'persian_alpha',
|
|
'min:3',
|
|
'max:100',
|
|
],
|
|
|
|
'mobile' => [
|
|
'required',
|
|
'ir_mobile:zero',
|
|
Rule::unique('users', 'mobile')
|
|
->ignore(auth()->id()),
|
|
],
|
|
|
|
'email' => [
|
|
'required',
|
|
'email',
|
|
'max:150',
|
|
Rule::unique('users', 'email')
|
|
->ignore(auth()->id()),
|
|
],
|
|
|
|
'current_password' => [
|
|
'nullable',
|
|
'current_password',
|
|
],
|
|
|
|
'new_password' => [
|
|
'nullable',
|
|
'string',
|
|
'min:6',
|
|
'max:255',
|
|
'confirmed',
|
|
],
|
|
'image' => [
|
|
'nullable',
|
|
'image',
|
|
'mimes:jpg,jpeg,png,webp',
|
|
'max:2048',
|
|
],
|
|
'province_id' => ['nullable', 'string'],
|
|
'city_id' => ['nullable', 'string'],
|
|
];
|
|
}
|
|
}
|