@php $groupedCategories = $categories->groupBy('parent_id'); $currentCategories = $groupedCategories->get(0); @endphp @if($currentCategories) @foreach ($currentCategories as $category) @php $hasChildren = $groupedCategories->has($category->id); @endphp @if ((!$more && $loop->index < 10) || ($more && $loop->index >= 10))
  • @if ($iconImage = $category->icon_image) {{ $category->name }} @elseif ($icon = $category->icon) @endif {{ $category->name }} @if ($hasChildren) @php $currentCategories = $groupedCategories->get($category->id); @endphp @if($currentCategories) @endif @endif
  • @endif @endforeach @endif