I have an auto generated fields using jquery and my problem now is how to get error message without showing the index key. This is my code below:
@for($num = 0; $num < old('number', 1); $num++)
<input type="text" class="form-control guest_name" name="last_name[]" id="last_name" placeholder="lastname" value="">
@if ($errors->has('last_name' . ($num)))
<div class="form-group">
<p class="text-danger"></p>
</div>
@endif
@endfor
This is my validation:
for($i=0; $i < count($this->request->get('last_name')); $i++){
$rules['last_name'.$i] = ['required'];
}
return $rules;
And now, the validation message is like this:
last name0 is required.
How can I just display it as last name is required.?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2MKINsW
via IFTTT
Aucun commentaire:
Enregistrer un commentaire