I have validation:
public function saveUser($request)
{
// validacja
$this->validate($request, [
'name' => 'required|string',
'surname' => 'required|string',
'email' => 'required|email'
]);
if ($request->hasFile('userPicture')) {
$this->validate($request, [
'userPicture' => 'image|max:1000'
]);
}
// save
}
I need add to this validation:
'userPicture' => 'image|max:1000'
- file type: only jpg/jpeg
How can I do this ?