@php $nav = [ 'Dashboard' => 'kitchen.dashboard', 'Requisitions' => 'kitchen.requisitions', 'Ledger' => 'kitchen.ledger', 'Stock take' => 'kitchen.stock-take', 'Recipes' => 'kitchen.recipes', 'Menus' => 'kitchen.menus', 'Food cost' => 'kitchen.food-cost', 'Votes' => 'kitchen.votes', 'Purchase requisitions' => 'kitchen.purchase-requisitions', ]; $current = request()->route()?->getName() ?? ''; $active = null; foreach (array_reverse($nav, true) as $label => $route) { if ($current === $route || str_starts_with($current, $route . '.')) { $active = $label; break; } } @endphp
@foreach($nav as $label => $route) {{ $label }} @endforeach