{{--
--}} @php $normalLaneCount = App\Models\Application::whereHas('payment.pricing', function ($q) { $q->where('lane', App\Models\PricingScheme::LANE_NORMAL); })->count(); $fastLaneCount = App\Models\Application::whereHas('payment.pricing', function ($q) { $q->where('lane', App\Models\PricingScheme::LANE_FAST); })->count(); $superFastLaneCount = App\Models\Application::whereHas('payment.pricing', function ($q) { $q->where('lane', App\Models\PricingScheme::LANE_SUPER_FAST); })->count(); $incompleteApplications = App\Models\Application::where('status', App\Models\Application::STATUS_INCOMPLETE)->count() ?? 0; $replacements = [ '__normalLane__' => $normalLaneCount, '__fastLane__' => $fastLaneCount, '__superFastLane__' => $superFastLaneCount, '__incomplete__' => $incompleteApplications, ]; // Replace placeholders $menusJson = json_encode($menus); $menusJson = str_replace(array_keys($replacements), array_values($replacements), $menusJson); $menus = json_decode($menusJson, true); @endphp @foreach ($menus as $menu) @if (!empty($menu['submenu'])) @php $routes = is_array($menu['route']) ? $menu['route'] : [$menu['route']]; $match = false; foreach ($routes as $r) { // If the route has a dot, match it and its subroutes if (Str::contains($r, '.')) { if (request()->routeIs($r) || request()->routeIs($r . '.*')) { $match = true; break; } } else { // Match route and its subroutes if (request()->routeIs($r) || request()->routeIs($r . '.*')) { $match = true; break; } } } @endphp @else @endif @endforeach