working with laravel 5.6 and I have bootstrap sidemenu items, like this
<li class="{{ active_menu(Route::CurrentRouteName(), 'reports', 0,7)}}">
<a href="{{route('reports.alluser')}}">All Users</a></li>
<li class="{{ active_menu(Route::CurrentRouteName(), 'reports', 0,7)}}">
<a href="{{route('reports.pie_chart')}}">Category Chart</a></li>
<li class="{{ active_menu(Route::CurrentRouteName(), 'reports', 0,7)}}">
<a href="{{route('reports.categorystatic')}}">Category Static</a></li>
I have helper function for this sidemenu in app/helper/Helper.php
<?php
if(! function_exists('active_menu')) {
function active_menu($currentRouteName, $requestName, $start, $finish){
if (substr($currentRouteName,$start, $finish) == $requestName){
return 'active';
}else{
return null;
}
}
}
but when I click one menu link above highlight all menu links. problem is here in the all links, it is highlight all menu witch include 'reports', 0,7
'reports', 0,7
How can I prevent highlighting all menu items and highlighting only selected menu item?
how can I fix this problem here?