@php $nav = [ 'Dashboard' => 'library.dashboard', 'Catalogue' => 'library.inventory', 'Circulation' => 'library.circulation', 'Stocktake' => 'library.stocktake', 'Acquisitions' => 'library.acquisitions', 'Reports' => 'library.reports', ]; $current = request()->route()?->getName() ?? ''; $active = null; foreach ($nav as $label => $route) { if ($current === $route || str_starts_with($current, $route . '.')) { $active = $label; break; } } if (!$active && str_starts_with($current, 'library.books')) { $active = 'Catalogue'; } @endphp