如何解决如何根据其父类别显示或索引空间?
我已经应用了具有无限级别子类别的递归关系。我也相应地显示了它。但是问题是我想在下拉列表中索引类别,子类别,sub_subcategory。到目前为止,它没有索引,并且下拉列表中的每个类别看起来都像父类别。
<div class="col-sm-6">
<select name="parent_id" class="form-control">
<option value="">{{translate('Please Select')}}</option>
@foreach($types as $type)
@if($type->parent_id == null || $type->parent_id == 0)
<option value="{{$type->id}}">{{$type->title}}</option>
@endif
@foreach($type->children as $children)
@include('system.business-type.createRecursive',['children'=>$children])
@endforeach
@endforeach
</select>
</div>
递归刀片
<option value="{{$children->id}}">{{$children->title}}</option>
@if(count($children->childs) > 0)
@foreach($children->childs as $t)
@include('system.business-type.createRecursive',['children'=>$t])
@endforeach
@endif
预期产量 https://imghostr.com/bf269a_qly
我的输出 https://imghostr.com/1519a8_3he
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。