I have an array of files being uploaded. In the validation.php language file I've added custom error messages:
'custom' => [
'images.*' => [
'dimensions' => 'Image ":file" must have a min-height of :min_height pixels and a min-width of :min_width pixels.',
'image' => 'You can only upload images to your gallery. The file ":file" was not an image.',
'mimes' => 'Your image ":file" was an invalid type. Images can only be of the following types: :mimes',
'max' => 'Max file size for each image is :max MB. Your image ":file" is too large.'
]
]
Since there are multiple files being uploaded, I would like to be able to specify which file the error message relates to when I display the validation errors.
@if($errors->has('images.*'))
@foreach ($errors->get('images.*') as $message)
<div class="help-block has-error">{{ head($message) }}</div>
@endforeach
@endif
However, :file is not auto filled in the message and I don't know how to get it.
How would I go about doing this? Is there another placeholder or method I can use?