fix: resolve form request validation errors on profile update
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Account;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class EditProfileUpdateRequest 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',
|
||||
'min:2',
|
||||
'max:64',
|
||||
'persian_alpha'
|
||||
],
|
||||
'last_name' => [
|
||||
'required',
|
||||
'min:3',
|
||||
'max:64',
|
||||
'persian_alpha'
|
||||
],
|
||||
'mobile' => [
|
||||
'required',
|
||||
'string',
|
||||
'ir_mobile:zero'
|
||||
],
|
||||
'email' => [
|
||||
'required',
|
||||
'email',
|
||||
'max:150',
|
||||
'unique:App\Models\User,email,' . auth()->id()
|
||||
],
|
||||
'province_id' => [
|
||||
'nullable',
|
||||
'exists:provinces,id'
|
||||
],
|
||||
'city_id' => [
|
||||
'nullable',
|
||||
'exists:cities,id'
|
||||
],
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user