Laravel multi select box get old value:
Hi, Some time we want to get old values in laravel (when there is some validation apply on a form.).In this case, genrally we are unable to get old value for a multiple select box.
For this use this code:
<select name="tribe[]" id="tags" class="form-control" multiple>
@if (is_array(old('tribe')))
@foreach ($tribes as $tribe)
<option value="{{ $tribe->id }}" <?php if(in_array($tribe->id, old('tribe'))) {echo 'selected';} ?> >{{ $tribe->name }}</option>
@endforeach
@else
@foreach ($tribes as $tribe)
<option value="{{ $tribe->id }}" >{{ $tribe->name }}</option>
@endforeach
@endif
</select>
This will help for get old values in multiple select box.
Thanks
Betway Casino App - Download for Android (.apk) & iPhone
ReplyDeleteBetway casino app provides a comprehensive range 이천 출장안마 of sports betting options including NFL, NBA, 당진 출장샵 NHL and 계룡 출장샵 more. The app 양주 출장마사지 has 구미 출장마사지 been around since its