Setting Bootstrap navbar active class in Laravel 5

If you are working with named routes. You can use this approach in your views:

{{ Route::currentRouteNamed('about') ? 'active' : '' }}

or

{{ Route::is('about') ? 'active' : '' }}

The Illuminate\Routing\Router#is(...) is an alias of the Illuminate\Routing\Router#currentRouteNamed(...).

Leave a Comment