array value auto fill in old value laravel 8

Solutions on MaxInterview for array value auto fill in old value laravel 8 by the best coders in the world

showing results for - "array value auto fill in old value laravel 8"
Zeb
07 Aug 2016
1{{ (collect(old('forWhom'))->contains($key)) ? 'selected':'' }} 
2
3{{ (in_array($key,$info->forWhom)) ? 'selected' : ''}}
4
Sergio
21 Nov 2020
1<select id="recommended_food"   multiple="multiple" size=3 style='height: 100%;' name="recommended_food[]">
2    @if ($food->recomemded_food)
3      {{ ($val = 'Fries')
4        && $chosen = in_array($val, $food->recommended_food)
5        ? 'selected':null}}
6      <option value="{{$val}}" {{$chosen}}>{{$val}}</option>
7      {{ ($val = 'Hot Dogs')
8        && $chosen = in_array($val, $food->recommended_food)
9        ? 'selected':null}}
10      <option value="{{$val}}" {{$chosen}}>{{$val}}</option>
11      {{ ($val = 'Hamburgers')
12        && $chosen = in_array($val, $food->recommended_food)
13        ? 'selected':null}}
14      <option value="{{$val}}" {{$chosen}}>{{$val}}</option>
15    @endif
16  </select>
17
Amine
07 Jan 2020
1<select id="forWhom" name="forWhom[]" multiple class="form-control chosen">
2        <option value="">--- Select ---</option>
3        @foreach ($desgInfo as $key => $value)
4            <option value="{{ $key }}" 
5               {{ (collect(old('forWhom'))->contains($key)) ? 'selected':'' }} 
6               {{ (in_array($key,$info->forWhom)) ? 'selected' : ''}}  
7               />
8               {{ $value }}
9            </option>
10        @endforeach
11    </select>
12
Ilene
11 Jan 2019
1#1.
2<div class="form-group">
3  <label for="roles" class="form-control-label">Roles</label>
4  <select name="roles[]" id="roles" data-placeholder="Choose role..." multiple class="standardSelect">
5    <option value="" label="default"></option>
6    @foreach($roles as $role)
7      <option value="{{ $role }}" {!! (collect(old('roles'))->contains($role)) ? 'selected="selected"' : '' !!}>{{ $role }}</option>
8    @endforeach
9  </select>
10 </div>
11#2.  
12@if(count($categories) > 0)
13  @foreach($categories as $category)
14      <option value="{{ $category->id }}" {{ (old('lawyer_fields') == null ? '' : in_array($category->id ,old('lawyer_fields')) ? "selected":"") }}>
15                                            {{ $category->name }}
16      </option>
17  @endforeach
18  @else
19       <option disabled>بدون انتخاب</option>
20@endif
21#3.
22<label for="name">Tags</label>
23    <select name="tags[]" class="form-control select-tag" multiple>
24      @foreach($tags as $tag)
25        <option value="{{$tag->id}}" {{in_array($tag->id, old("tags") ?: []) ? "selected": ""}}>{{$tag->name}}</option>
26      @endforeach
27 </select>
Killian
29 Jan 2017
1<select id="forWhom" name="forWhom[]" multiple class="form-control chosen">
2    <option value="">--- Select ---</option>
3    @foreach ($desgInfo as $key => $value)
4        <option value="{{ $key }}" 
5           {{ (collect(old('forWhom'))->contains($key)) ? 'selected':'' }}  />
6           {{ $value }}
7        </option>
8    @endforeach
9</select>
10
Gaspard
30 Aug 2017
1<select name="options[]" id="options" class="form-control" multiple>
2    @foreach($settings->includes->get('optionList') as $option)
3        <option value="{{ $option->id }}" {{ (collect(old('options'))->contains($option->id)) ? 'selected':'' }}>{{ $option->name }}</option>
4    @endforeach
5</select>
6
Mads
17 Sep 2017
1<label for="name">Tags</label>
2    <select name="tags[]" class="form-control select-tag" multiple>
3      @foreach($tags as $tag)
4        <option value="{{$tag->id}}" {{in_array($tag->id, old("tags") ?: []) ? "selected": ""}}>{{$tag->name}}</option>
5      @endforeach
6    </select>
7