public static function setActiveIDs($reset = false)
    {
        if(!self::$activeIDs || $reset) {
            // Get current Menu Link
            $currentRoute = \Request::route();

            // Get active MenuLinks by routeName and params
            $currentMenuLinkIDs = [];
            $isDefaultLanguage = (App::getLocale() == Language::getDefault('slug') ? '.default' : false);
            foreach (MenuLink::all() as $menuLink) {
                $menuLinkRoute = Route::getRoutes()->getByName($menuLink->routeName . $isDefaultLanguage);
                // maybe route doesn't have .default suffix
                if (!$menuLinkRoute) {
                    $menuLinkRoute = Route::getRoutes()->getByName($menuLink->routeName);
                }

                if($menuLinkRoute) {                //route is found|
                    self::matchRoute($currentMenuLinkIDs, $menuLink, $currentRoute, $menuLinkRoute);
                    self::checkCategoryMatch($currentMenuLinkIDs, $menuLink);
                }
            }

            if($currentMenuLinkIDs) {
                self::$activeIDs = array_unique($currentMenuLinkIDs);
            }
        }
    }
public static function setActiveIDs($reset = false)
    {
        if(!self::$activeIDs || $reset) {
            // Get current Menu Link
            $currentRoute = \Request::route();

            // Get active MenuLinks by routeName and params
            $currentMenuLinkIDs = [];
            $isDefaultLanguage = (App::getLocale() == Language::getDefault('slug') ? '.default' : false);
            foreach (MenuLink::all() as $menuLink) {
                $menuLinkRoute = Route::getRoutes()->getByName($menuLink->routeName . $isDefaultLanguage);
                // maybe route doesn't have .default suffix
                if (!$menuLinkRoute) {
                    $menuLinkRoute = Route::getRoutes()->getByName($menuLink->routeName);
                }

                if($menuLinkRoute) {                //route is found|
                    self::matchRoute($currentMenuLinkIDs, $menuLink, $currentRoute, $menuLinkRoute);
                    self::checkCategoryMatch($currentMenuLinkIDs, $menuLink);
                }
            }

            if($currentMenuLinkIDs) {
                self::$activeIDs = array_unique($currentMenuLinkIDs);
            }
        }
    }
public static function setActiveIDs ( $ reset = false ) { if ( ! self :: $ activeIDs || $ reset ) { // Get current Menu Link $ currentRoute = \ Request :: route ( ) ; // Get active MenuLinks by routeName and params $ currentMenuLinkIDs = [ ] ; $ isDefaultLanguage = ( App :: getLocale ( ) == Language :: getDefault ( 'slug' ) ? '.default' : false ) ; foreach ( MenuLink :: all ( ) as $ menuLink ) { $ menuLinkRoute = Route :: getRoutes ( ) -> getByName ( $ menuLink -> routeName . $ isDefaultLanguage ) ; // maybe route doesn't have .default suffix if ( ! $ menuLinkRoute ) { $ menuLinkRoute = Route :: getRoutes ( ) -> getByName ( $ menuLink -> routeName ) ; } if ( $ menuLinkRoute ) { //route is found| self :: matchRoute ( $ currentMenuLinkIDs , $ menuLink , $ currentRoute , $ menuLinkRoute ) ; self :: checkCategoryMatch ( $ currentMenuLinkIDs , $ menuLink ) ; } } if ( $ currentMenuLinkIDs ) { self :: $ activeIDs = array_unique ( $ currentMenuLinkIDs ) ; } } }
Set current MenuLink IDs.

We use routeName and params to match active MenuLinks.
While the same MenuLink can be linked to different Menus and they have the same params and routeName,
there is currently no way to identify which of them is active, therefore all of their IDs are returned.

@param  bool $reset
@throws \Exception
Set current MenuLink IDs .