James Bhatta
James Bhatta's blog

James Bhatta's blog

Styling active route menu item in laravel

James Bhatta's photo
James Bhatta
·May 17, 2022·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

You can check if the current route is active just with


Or even sub-routes (like editing, creating, or whatever with


If you prefer to use the route facade, you still can do that with


By using the * character, you can apply the active class to submenus easily:

routeIs('admin.cities*') ? 'active' : '' }}"> Cities
routeIs('admin.cities.index') ? 'active' : '' }}><a>List</a>
routeIs('admin.cities.create') ? 'active' : '' }}><a>Create</a>
Share this