__('Dashboard'), 'url' => '/admin/dashboard', 'active' => $routeName === 'admin.dashboard' ]; $moduleMap = [ 'admin.warehouses' => __('Warehouse Management'), // ... simplified ]; $foundModule = null; foreach ($moduleMap as $prefix => $label) { if (str_starts_with($routeName, $prefix)) { $foundModule = [ 'label' => $label, 'url' => '#', 'active' => false ]; break; } } if ($foundModule) { $links[] = $foundModule; } $segments = explode('.', $routeName); $lastSegment = end($segments); // Simplifed page labels $pageLabel = match($lastSegment) { 'inventory' => __('Inventory Management'), 'index' => 'Warehouse Overview', default => null, }; if ($pageLabel) { $links[] = [ 'label' => $pageLabel, 'active' => true ]; } echo "Route: $routeName\n"; foreach ($links as $link) { echo " - " . $link['label'] . ($link['active'] ? " (active)" : "") . "\n"; } echo "\n"; } testBreadcrumbs('admin.warehouses.inventory'); testBreadcrumbs('admin.warehouses.index');