Laravel 如何在同一foreach中的另一个foreach标记内使用foreach中的单个值

Laravel 如何在同一foreach中的另一个foreach标记内使用foreach中的单个值,laravel,laravel-5,foreach,laravel-views,Laravel,Laravel 5,Foreach,Laravel Views,在我的视图页面中,我使用了以下循环: @foreach ($type as $ingtype) <h4>{{$ingtype->Ing_type}}</h4> @foreach (${{$ingtype->Ing_type}} as $ing) <input type="checkbox" name="ing[]" value="{{$ing->ing_id}}" /> &

在我的视图页面中,我使用了以下循环:

@foreach ($type as $ingtype)    
   <h4>{{$ingtype->Ing_type}}</h4> 
       @foreach (${{$ingtype->Ing_type}} as $ing)
          <input type="checkbox" name="ing[]" value="{{$ing->ing_id}}" />
          <label for="{{$ing->Ing_name}}">{{$ing->Ing_name}}</label>
       @endforeach
@endforeach
@foreach($type为$ingtype)
{{$ingtype->Ing_type}
@foreach(${{$ingtype->Ing_type}}作为$Ing)
{{$ing->ing_name}
@endforeach
@endforeach
我想在这里做的是从

{{$ingtype->Ing_type}

我吃牛奶、蔬菜、肉等等。所以我需要foreach中的这些值

@foreach(${{$ingtype->Ing_type}}作为$Ing)

这一定意味着

($Dairy作为$ing)

然后另一个循环给出

($蔬菜作为$ing)


你可以像这样直接使用

@foreach ($type as $ingtype)    
   <h4>{{$ingtype->Ing_type}}</h4> 
   @foreach ($ingtype->Ing_type as $ing)
      <input type="checkbox" name="ing[]" value="{{$ing->ing_id}}" />
      <label for="{{$ing->Ing_name}}">{{$ing->Ing_name}}</label>
   @endforeach
@endforeach
@foreach($type为$ingtype)
{{$ingtype->Ing_type}
@foreach($ingtype->Ing\u类型为$Ing)
{{$ing->ing_name}
@endforeach
@endforeach

请提供$typei的数据结构,并在foreach中传递无效参数的错误