samedi 17 novembre 2018

How to use a unique id for each menu and highlight by id rather than a class in Laravel 5.6?

working with laravel 5.6 and I have bootstrap sidemenu items, like this,

<li class="">
    <a href="">All Users</a></li>

    <li class="">
    <a href="">Category Chart</a></li>

    <li class="">
    <a href="">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? I think if I use id rather than class I can fix the problem. but I have no an idea how can I use id for above code segments. give me some solution



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire