Condition and loop in laravel

Example :

For Each in blade

<select id="basic" name="status_id" class="selectpicker show-tick form-control"> 
                            @foreach($status as $i => $st)  
                               @if(isset($restaurant->status_id) && ($restaurant->status_id==$st->id) ) 
                                    <option value="{{$st->id}}" selected="selected" >{{$st->name}}</option>    
                                @else
                                <option value="{{$st->id}}">{{$st->name}}</option>
                                @endif                         
                            @endforeach
                        </select>

Comments

Popular Posts