У меня есть массив загружаемых файлов. В языковой файл validation.php
я добавил пользовательские сообщения об ошибках:
'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.'
]
]
Поскольку загружается несколько файлов, я хотел бы указать, к какому файлу относится сообщение об ошибке, когда я отображаю ошибки проверки.
@if($errors->has('images.*'))
@foreach ($errors->get('images.*') as $message)
<div class="help-block has-error">{{ head($message) }}</div>
@endforeach
@endif
Однако :file
не заполняется автоматически в сообщении, и я не знаю, как его получить.
Как мне это сделать? Есть ли другой заполнитель или метод, который я могу использовать?