Shouldn't you add
'sometimes|required|...
?
Hi, I would like to validate image only if the user select an image. if the user dosent select any image then i dont want to validate the image. i am using this validation in my controller but it still gives me an error that he "images must be a file of type: jpeg, png, jpg, gif, svg." Any good solution?
$request->validate([
'name' => 'required',
'images' => 'sometimes|nullable|mimes:jpeg,png,jpg,gif,svg',
]);
Please or to participate in this conversation.