mardi 6 février 2018

Laravel Menu issue

I have the code below to read my menu items from a model, loaded from a DB. I need to set them active based on the current URL. This code only works for the root '/' it doesn't work for others, even though if I echo out the values, url($menu->link) and Request::url() they are the same.

@foreach($menus as $menu)
    <li>
        <a href="" @if(Request::is($menu->link))  class="active" @endif>
            <span class="glyphicon "></span>
                
        </a>
    </li>
@endforeach

What am I doing wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire