Answer the question
In order to leave comments, you need to log in
How to formulate a validation rule when updating a user's avatar?
Good day, I ran into an image validation problem when updating user data.
There is a set of validation rules:
public function rules()
{
return [
'fname' => 'required|alpha|string|max:255',
'lname' => 'required|alpha|string|max:255',
'pname' => 'required|alpha|string|max:255',
'avatar' => 'nullable|image|mimes:jpeg,png',
'birth_date' => 'required|date',
'login' => "required|unique:employees,login,{$this->id}",
'password' => 'nullable|min:10|alpha_dash',
'role' => 'required',
'phones' => 'required|array',
'phones.*.phone' => 'required|numeric',
'phones.*.is_personal' => 'nullable|boolean',
'phones.*.is_work' => 'nullable|boolean',
'emails' => 'required|array',
'emails.*.email' => 'required|email',
];
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question