src/Repositories/EloquentMenu.php
public function setClass($menulink)
    {
        $classArray = preg_split('/ /', $menulink->class, null, PREG_SPLIT_NO_EMPTY);
        // add active class if current uri is equal to item uri or contains
        // item uri and is bigger than 3 to avoid homepage link always active ('/', '/lg')
        $pattern = $menulink->href;
        if (strlen($menulink->href) > 3) {
            $pattern .= '*';
        }
        if (request()->is($pattern)) {
            $classArray[] = 'active';
        }

        return implode(' ', $classArray);
    }
public function setClass($menulink)
    {
        $classArray = preg_split('/ /', $menulink->class, null, PREG_SPLIT_NO_EMPTY);
        // add active class if current uri is equal to item uri or contains
        // item uri and is bigger than 3 to avoid homepage link always active ('/', '/lg')
        $pattern = $menulink->href;
        if (strlen($menulink->href) > 3) {
            $pattern .= '*';
        }
        if (request()->is($pattern)) {
            $classArray[] = 'active';
        }

        return implode(' ', $classArray);
    }
public function setClass ( $ menulink ) { $ classArray = preg_split ( '/ /' , $ menulink -> class , null , PREG_SPLIT_NO_EMPTY ) ; // add active class if current uri is equal to item uri or contains // item uri and is bigger than 3 to avoid homepage link always active ('/', '/lg') $ pattern = $ menulink -> href ; if ( strlen ( $ menulink -> href ) > 3 ) { $ pattern .= '*' ; } if ( request ( ) -> is ( $ pattern ) ) { $ classArray [ ] = 'active' ; } return implode ( ' ' , $ classArray ) ; }
Take the classes from field and add active if needed.

@param $menulink

@return string classes
Take the classes from field and add active if needed .