@php $nav = [ 'Collect' => 'finance.collect', 'M-Pesa Pay' => 'mpesa.pay', 'Fee setup' => 'finance.fees', 'Invoice Distribution' => 'finance.invoice-distribution', 'Activity Fees' => 'finance.activity-fees', 'Incoming' => 'finance.incoming', 'Government' => 'finance.government', 'Promissory' => 'finance.promissory', 'Income' => 'finance.income', 'Expenses' => 'finance.expenses', 'Suppliers' => 'finance.suppliers', 'Journals' => 'finance.journals', 'Reports' => 'finance.reports', 'Accounting' => 'finance.accounting', 'Profit & Loss' => 'finance.profit-and-loss', 'Settings' => 'finance.settings', ]; $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, 'finance.receipt')) { $active = 'Collect'; } if (!$active && str_starts_with($current, 'finance.statement')) { $active = 'Collect'; } @endphp