categories.blade.php
670 Bytes
@if ($items->where('parent_id', $parent)->count())
@php $level++ @endphp
<? $array = $items->where('parent_id', $parent) ?>
@foreach ($array as $item)
@if($level)
<li><a href="{{ route('catalog_detail', $item->id)}}">{{ $item->name }}</a></li>
@else
</ul>
<button class="catalog-accordion js_catalog_accordion">{{$item->name}}</button>
<ul class="catalog-accordion-panel">
@endif
<? /*if($item == end($array)) {?>
</ul>
<? $level = -1;
}*/?>
@include('part.categories', ['level' => $level, 'parent' => $item->id])
@endforeach
@endif