@php // Get menu items from Pages with nested children $menuItems = \App\Models\Page::with(['children' => function ($query) { $query->where('status', 'published') ->where('show_in_menu', true) ->orderBy('sort_order', 'asc') ->orderBy('title', 'asc'); }, 'children.children' => function ($query) { $query->where('status', 'published') ->where('show_in_menu', true) ->orderBy('sort_order', 'asc') ->orderBy('title', 'asc'); }]) ->whereNull('parent_id') ->where('status', 'published') ->where('show_in_menu', true) ->orderBy('sort_order', 'asc') ->orderBy('title', 'asc') ->get(); // Check if we're on homepage - multiple checks for reliability $currentRoute = request()->route() ? request()->route()->getName() : null; $currentPath = request()->path(); $isHomepage = $currentRoute === 'homepage' || $currentPath === '/' || request()->is('/'); @endphp @if($isHomepage) @include('components.custom.language-selector', ['variant' => 'offcanvas']) @foreach($menuItems->slice(0, ceil($menuItems->count() / 2)) as $item) @endforeach @foreach($menuItems->slice(ceil($menuItems->count() / 2)) as $item) @endforeach @else @foreach($menuItems as $item) @endforeach @if(!empty($social_media['Twitter'])) @endif @if(!empty($social_media['Facebook'])) @endif @if(!empty($social_media['Github'])) @endif @if(!empty($social_media['Instagram'])) @endif @if(!empty($social_media['Youtube'])) @endif @include("components.custom.language-selector") {{-- Mobile menu is dark, so we only need the light (white) logo here --}} @include('components.custom.language-selector', ['variant' => 'offcanvas']) @foreach($menuItems as $item) @endforeach @endif