@php
$currentSlug = request()->route('slug') ?? ($landingSlug ?? null);
@endphp
{{-- Expand/Collapse all --}}
@if(isset($categories) && $categories->isNotEmpty())
{{-- Categories --}}
@php $defaultOpenCat = null;
if (request()->routeIs('category.show')) {
$catSlug = request()->route('slug');
foreach ($categories as $cat) {
if ($cat->translation($locale)?->slug === $catSlug) {
$defaultOpenCat = $cat->id;
break;
}
}
if (!$defaultOpenCat && isset($excludedCategories)) {
foreach ($excludedCategories as $cat) {
if ($cat->translation($locale)?->slug === $catSlug) {
$defaultOpenCat = $cat->id;
break;
}
}
}
}
if (!$defaultOpenCat) {
foreach ($categories as $cat) {
if ($cat->posts->contains(fn($p) => $p->translation($locale)?->slug === $currentSlug)) {
$defaultOpenCat = $cat->id;
break;
}
}
}
if (!$defaultOpenCat && isset($excludedCategories)) {
foreach ($excludedCategories as $cat) {
if ($cat->posts->contains(fn($p) => $p->translation($locale)?->slug === $currentSlug)) {
$defaultOpenCat = $cat->id;
break;
}
}
}
@endphp
id }}: true,@endforeach @if(isset($excludedCategories)) @foreach($excludedCategories as $c){{ $c->id }}: true,@endforeach @endif } } else { openCats = {} }"
class="overflow-hidden bg-gray-100 border border-gray-300 rounded-lg shadow-md dark:border-gray-500 dark:bg-gray-700">
@foreach($categories as $category)
@php $catTrans = $category->translation($locale); @endphp
@if($catTrans && $catTrans->slug)
@php $isActiveCat = request()->routeIs('category.show') && request()->route('slug') === $catTrans->slug; @endphp
-
id !== $defaultOpenCat) x-cloak @endif class="bg-white dark:bg-gray-800">
@foreach($category->posts as $post)
@php $postTrans = $post->translation($locale); @endphp
@if($postTrans && $postTrans->slug)
@php $isActive = ($postTrans->slug === $currentSlug); @endphp
@php $hasSubPages = $isActive && count($sidebarSubPages ?? []) > 1; @endphp
-
@if($hasSubPages)
@endif
@endif
@endforeach
@endif
@endforeach
{{-- Excluded categories (admin only) --}}
@if(isset($excludedCategories) && $excludedCategories->isNotEmpty())
@foreach($excludedCategories as $category)
@php $catTrans = $category->translation($locale); @endphp
@if($catTrans && $catTrans->slug)
@php $isActiveCat = request()->routeIs('category.show') && request()->route('slug') === $catTrans->slug; @endphp
-
@endif
@endforeach
@endif
@endif
{{-- Pages --}}
@if(isset($pages) && $pages->isNotEmpty())
@foreach($pages as $pg)
@php $pgTrans = $pg->translation($locale); @endphp
@if($pgTrans && $pgTrans->slug)
@php $isPageActive = ($pgTrans->slug === $currentSlug); @endphp
-
{{ $pgTrans->title }}
@endif
@endforeach
@endif
{{-- Search --}}
{{-- Contact & YouTube --}}