You can check if the current route is active just with
request()->routeIs('admin.cities')
Or even sub-routes (like editing, creating, or whatever with
request()->routeIs('admin.cities*')
If you prefer to use the route facade, you still can do that with
Route::named('admin.cities*')
By using the * character, you can apply the active class to sub-menus easily:
routeIs('admin.cities*') ? 'active' : '' }}"> Cities
routeIs('admin.cities.index') ? 'active' : '' }}><a>List</a>
routeIs('admin.cities.create') ? 'active' : '' }}><a>Create</a>
Top comments (0)