@php $dashboard_url = route(config('larasnap.general.dashboard_route_name')); //replace dashboard url to 'empty string' //explode by '/' //pass to 'array_filter' to remove the empty array value(here index-0) $segments = array_filter(explode('/', str_replace($dashboard_url , '', Request::url()))); $url = $dashboard_url; @endphp @if(count($segments) == 0)
  1. Dashboard
  2. @else
  3. Dashboard
  4. @foreach ($segments as $segment) @php $url .= '/'.$segment; @endphp @if ($loop->first && !$loop->last)
  5. {{ ucfirst($segment) }}
  6. @else
  7. {{ ucfirst($segment) }}
  8. @endif @endforeach @endif