当id匹配时,使动态复选框“已选中”

时间:2016-12-17 20:28:09

标签: php html5 laravel

<div class="tab-content">
     @foreach($groups as $group)
          <div role="tabpanel" class="tab-pane" id="grp-{{ $group->id }}">
                @foreach($ingreds as $ingred)
                       @if($ingred->id_ingredient_group==$group->id)
                           <label>
                                <input type="checkbox" name="ingredients[]"  @foreach($item->ingredients as $ingredient)  @if($ingred->id==$ingredient->data->id) {{"checked"}} @endif   @endforeach  value="{{$ingred->id}}"> {{ $ingred->name}}
                           </label>

                       @endif
                 @endforeach
          </div>
     @endforeach
 </div>

我希望"$ingred->id==$ingredient->data->id"比我的复选框更有效,但不会发生。

0 个答案:

没有答案