In my CustomFormRequest file I have the following rule for image file:
public function rules() {
return [
'image' => 'image|max:2047',
];
}
and the appropriate validation messages:
public function messages() {
return [
'image.image' => 'The type of the uploaded file should be an image.',
'image.max' => 'Failed to upload an image. The image maximum size is 2MB.',
];
}
But the message for maximum size rule doesn't appear. The default message for max file size is appearing instead of it. What I'm doing wrong ?