categories.blade.php 648 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="{{$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