Support the ongoing development of →
posted 7 years ago
Last updated 9 months ago.

why not use {{URL::to('/contactus')}}?


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 class="left-link-container{{ active_route('*transparency*event*') }}">
    <a href="{{ route('', $state) }}">Events</a>

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!

Full Stack Europe

Your banner here too?

yokeswar yokeswar Joined 9 Oct 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 - All rights reserved.