此代码需要显示每个“子类别”的所有“子类别” 但是查看结果仅是第一个子类别。 我想念哪里?
查看1:
@foreach($treeView as $category)
<div class="collapse multi-collapse collapse in " id="8" >
<div class="col-md-2"> {{ $category->account_name}}</div>
<div class=" float-right"><button class="btn btn-success" data-toggle="collapse" data-target="#{{ $category->id}}8" aria-expanded="false" aria-controls="{{ $category->id}}8" @click="getSubaccount(); getNumberrawaccount();">
<span class="glyphicon glyphicon-eye-open"></span></button></div>
<br>
<div class="list-group">
@if(count($category->subcategories))
@include('tree2',['subcategories'=>$category->subcategories])
@endif
</div>
@endforeach
查看2:tree2
<div class='list-group'>
<br>
@foreach($subcategories as $subcategory)
<div class="list-group col-md-12">
<div class="collapse multi-collapse" id="{{ $category->id}}8" >
<div class="col-md-4"> {{ $subcategory->subaccount_name }}</div>
<div class=" float-right"><button class="btn btn-success" data-toggle="collapse" data-target="#{{ $subcategory->id}}" aria-expanded="false" aria-controls="collapseExample2">
<span class="glyphicon glyphicon-eye-open"></span></button></div>
</div>
</div>
@endforeach
</div>
谢谢