Support the ongoing development of Laravel.io →
posted 9 years ago
Requests
Last updated 2 years ago.
0

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

0

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>
0

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?,..

0

Use the same helper in the parent menu and in the helper parameter, use just furniture or something like that.

0

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.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

yokeswar yokeswar Joined 9 Oct 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.