I use named routes and this helper:
if (!function_exists('active_route')) {
function active_route($route, $classname = 'active')
{
if (Route::currentRouteNamed($route) || Route::is($route)) {
return ' ' . $classname;
}
return '';
}
}
And use it like this:
<div class="left-link-container{{ active_route('transparency.campaigns') }}">
<a href="{{ route('transparency.campaigns', $state) }}">Campaigns</a>
</div>
<div class="left-link-container{{ active_route('*transparency*event*') }}">
<a href="{{ route('transparency.events', $state) }}">Events</a>
</div>
Ok But i need to get parent link, for eg i'm in main menu Furniture then go to the submenus like sofas here i need to highlight the main menu furniture any posibblities?,..
Use the same helper in the parent menu and in the helper parameter, use just furniture or something like that.
Sorry i can't get you, i need to get both parent and child category then check the condition if requested url is the sub category or child category i need to highlight the main parent category. please give me an example to do that.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community