@php $currentRoute = request()->route()->getName(); $filteredItems = []; foreach ($items as $label => $route) { $filteredItems[$label] = $route; if ($route === $currentRoute) { break; // Stop adding items once we reach the current route } } @endphp