@php $isMega = ($isMega ?? false) === true; $collapseSub = ($collapseSub ?? true) === true; @endphp @foreach ($categories as $parent) @php $parentActive = $activeId === (int) $parent->id; $hasChildren = $parent->children && $parent->children->count() > 0; $childActive = $hasChildren && $parent->children->contains(fn ($c) => (int) $c->id === $activeId); $parentLabel = locale_category_name($parent); @endphp
  • $isMega])>
    @if ($hasChildren && ! $isMega) @endif $parentActive || $childActive, 'eca-category-tree-link--branch' => $hasChildren && ! $isMega, 'eca-category-tree-link--mega-parent' => $isMega && $hasChildren, 'eca-category-tree-link--mega-parent-only' => $isMega && ! $hasChildren, ]) @if (($closeOnNavigate ?? false) === true) @click="$dispatch('site-header:close-mega')" @endif > {{ $parentLabel }} @if ($hasChildren && ! $isMega) {{ $parent->children->count() }} @endif
    @if ($hasChildren) @endif
  • @endforeach