Skip to content
Advertisement

Laravel active menu item for url included parameters

I’m trying to set active class in my list item, but it doesn’t work.

My code in blade:

JavaScript

So, if I write: li class=”@if(getRouteName() == ‘site@index’){{ ‘active’ }}@endif” , it works nice, but in my case the problem is that I want to get ‘active’ class in foreach sites/’.$site->id.’/edit

Many thanks.

Advertisement

Answer

Use is() method. For example:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement