@php $is = fn($name) => request()->routeIs($name); $any = fn($names) => collect((array) $names)->contains(fn($n) => request()->routeIs($n)); \App\Models\Finance\ModuleSetting::ensureDefaults(); $publicFormVisible = fn($key) => \App\Models\Finance\ModuleSetting::allows('online_forms') && \App\Models\Finance\ModuleSetting::allows($key); $home = route('front.home'); $onHome = request()->routeIs('front.home'); $homeSection = fn($hash) => $onHome ? $hash : $home . $hash; // ✅ Active groups $aboutActive = $any([ 'front.about', 'front.online_education', 'front.mission', 'front.vision', 'front.objective', 'front.career_development', 'front.chancellor_founder', 'front.team.*', 'front.testimonials.*', ]); $acadActive = $any(['front.faculties.*', 'front.departments.*', 'front.programs.*', 'front.courses.*', 'front.carculam.*', 'front.faculty_profiles.*', 'front.research.*', 'front.downloads.*', 'front.academic_sections.*']); $mediaActive = $any(['front.posts.*', 'front.events.*', 'front.videos.*', 'front.galleries.*']); $servicesActive = $any(['front.search', 'front.certificate.*', 'front.employer.*', 'front.admission.*']); $officeActive = $any(['front.finance', 'front.academic_affairs', 'front.teaching', 'front.student_affairs', 'front.research_administration', 'front.administration', 'front.offices.*', 'front.committees.*']); // Language $locale = app()->getLocale(); $locales = config('app.available_locales', []); $navFaculties = \Illuminate\Support\Facades\Schema::hasTable('faculties') ? \App\Models\Faculty::query()->select('id', 'name', 'code')->orderBy('name')->get() : collect(); $navContentItems = \Illuminate\Support\Facades\Schema::hasTable('website_content_items') ? \App\Models\WebsiteContentItem::query() ->where('is_published', true) ->orderBy('sort_order') ->orderBy('title') ->get(['type', 'slug', 'title', 'icon']) ->groupBy('type') : collect(); $navPages = \Illuminate\Support\Facades\Schema::hasTable('pages') && \Illuminate\Support\Facades\Schema::hasColumn('pages', 'show_in_menu') ? \App\Models\Page::query() ->where('is_published', true) ->where('show_in_menu', true) ->when(\Illuminate\Support\Facades\Schema::hasColumn('pages', 'visibility'), fn ($query) => $query->where('visibility', 'public')) ->orderBy('sort_order') ->orderBy('title') ->get(['slug', 'title', 'menu_location']) ->groupBy('menu_location') : collect(); @endphp