I am trying to validate multiple select field but is is not giving any error message, if i am not selecting any image. This is my code –
$validatedData = $this->validate([
'images.*' => 'required|image'
]);
blade file code –
<input type="file" class="form-control" name="images" wire:model="images" multiple>
@error('images.*') <span class="text-danger">{{ $message }}</span> @enderror
2
Answers
laravel validation errors in views presented in different way, i think this part of laravel docs is answer of your question
https://laravel.com/docs/11.x/validation#quick-displaying-the-validation-errors
Multiple select field works as an array and there is no need to add
.*
both in validation and blade file. so code will be –