protected function getAllMenuLinkRoutes()
    {
        if(!$this->allMenuLinkRoutes) {
            $menuLinkRoutes = [];
            if(file_exists(Theme::getPath() . '/controllers')) {
                $controllers = File::files(Theme::getPath() . '/controllers');
                foreach ($controllers as $file) {
                    $controllerName = str_replace('.php', '', $file->getFileName());
                    $controllerClass = Theme::getNamespace() . '\\Controllers\\' . $controllerName;
                    $routes = $controllerClass::getMenuLinkRoutes($controllerName);
                    if ($routes) {
                        $menuLinkRoutes[$controllerName] = $routes;
                    }
                }
            }
            $this->allMenuLinkRoutes = $menuLinkRoutes;
        }


        // Check post types have routes
        $postTypes = PostType::where('isVisible', true)->get();
        foreach($postTypes as $postType){
            $postTypeControllerName = ucfirst(camel_case($postType->slug)).'Controller';

            // add default post_pages routes if they are not defined
            if($postType->slug == 'post_pages') {
                // ad single post route route
                if(!isset($this->allMenuLinkRoutes['PagesController'])) {
                    $this->allMenuLinkRoutes['PagesController'] = Post::getDefaultPostRoutes($postType);
                }
                continue;
            }

            // Define postType route if not defined in its own Controller
            if(Post::haveItsOwnController($postType->slug)) {
                if (!isset($this->allMenuLinkRoutes[$postTypeControllerName]['post_type'][$postType->slug])) {
                    $this->allMenuLinkRoutes[$postTypeControllerName]['post_type'][$postType->slug] = Post::getDefaultPostTypeRoutes($postType);
                }
                // default post routes
                if(!isset($this->allMenuLinkRoutes[$postTypeControllerName][$postType->slug])) {
                    $this->allMenuLinkRoutes[$postTypeControllerName][$postType->slug] = Post::getDefaultPostRoutes($postType);
                }
            }else{ // Define postType route if not defined in PostController

                // Default Post Type routes
                if (!isset($this->allMenuLinkRoutes['PostController']['post_type'][$postType->slug])) {
                    $this->allMenuLinkRoutes['PostController']['post_type'][$postType->slug] = Post::getDefaultPostTypeRoutes($postType);
                }
                // default post routes
                if(!isset($this->allMenuLinkRoutes['PostController'][$postType->slug])) {
                    $this->allMenuLinkRoutes['PostController'][$postType->slug] = Post::getDefaultPostRoutes($postType);
                }
            }
        }

        return $this->allMenuLinkRoutes;
    }
protected function getAllMenuLinkRoutes()
    {
        if(!$this->allMenuLinkRoutes) {
            $menuLinkRoutes = [];
            if(file_exists(Theme::getPath() . '/controllers')) {
                $controllers = File::files(Theme::getPath() . '/controllers');
                foreach ($controllers as $file) {
                    $controllerName = str_replace('.php', '', $file->getFileName());
                    $controllerClass = Theme::getNamespace() . '\\Controllers\\' . $controllerName;
                    $routes = $controllerClass::getMenuLinkRoutes($controllerName);
                    if ($routes) {
                        $menuLinkRoutes[$controllerName] = $routes;
                    }
                }
            }
            $this->allMenuLinkRoutes = $menuLinkRoutes;
        }


        // Check post types have routes
        $postTypes = PostType::where('isVisible', true)->get();
        foreach($postTypes as $postType){
            $postTypeControllerName = ucfirst(camel_case($postType->slug)).'Controller';

            // add default post_pages routes if they are not defined
            if($postType->slug == 'post_pages') {
                // ad single post route route
                if(!isset($this->allMenuLinkRoutes['PagesController'])) {
                    $this->allMenuLinkRoutes['PagesController'] = Post::getDefaultPostRoutes($postType);
                }
                continue;
            }

            // Define postType route if not defined in its own Controller
            if(Post::haveItsOwnController($postType->slug)) {
                if (!isset($this->allMenuLinkRoutes[$postTypeControllerName]['post_type'][$postType->slug])) {
                    $this->allMenuLinkRoutes[$postTypeControllerName]['post_type'][$postType->slug] = Post::getDefaultPostTypeRoutes($postType);
                }
                // default post routes
                if(!isset($this->allMenuLinkRoutes[$postTypeControllerName][$postType->slug])) {
                    $this->allMenuLinkRoutes[$postTypeControllerName][$postType->slug] = Post::getDefaultPostRoutes($postType);
                }
            }else{ // Define postType route if not defined in PostController

                // Default Post Type routes
                if (!isset($this->allMenuLinkRoutes['PostController']['post_type'][$postType->slug])) {
                    $this->allMenuLinkRoutes['PostController']['post_type'][$postType->slug] = Post::getDefaultPostTypeRoutes($postType);
                }
                // default post routes
                if(!isset($this->allMenuLinkRoutes['PostController'][$postType->slug])) {
                    $this->allMenuLinkRoutes['PostController'][$postType->slug] = Post::getDefaultPostRoutes($postType);
                }
            }
        }

        return $this->allMenuLinkRoutes;
    }
protected function getAllMenuLinkRoutes ( ) { if ( ! $ this -> allMenuLinkRoutes ) { $ menuLinkRoutes = [ ] ; if ( file_exists ( Theme :: getPath ( ) . '/controllers' ) ) { $ controllers = File :: files ( Theme :: getPath ( ) . '/controllers' ) ; foreach ( $ controllers as $ file ) { $ controllerName = str_replace ( '.php' , '' , $ file -> getFileName ( ) ) ; $ controllerClass = Theme :: getNamespace ( ) . '\\Controllers\\' . $ controllerName ; $ routes = $ controllerClass :: getMenuLinkRoutes ( $ controllerName ) ; if ( $ routes ) { $ menuLinkRoutes [ $ controllerName ] = $ routes ; } } } $ this -> allMenuLinkRoutes = $ menuLinkRoutes ; } // Check post types have routes $ postTypes = PostType :: where ( 'isVisible' , true ) -> get ( ) ; foreach ( $ postTypes as $ postType ) { $ postTypeControllerName = ucfirst ( camel_case ( $ postType -> slug ) ) . 'Controller' ; // add default post_pages routes if they are not defined if ( $ postType -> slug == 'post_pages' ) { // ad single post route route if ( ! isset ( $ this -> allMenuLinkRoutes [ 'PagesController' ] ) ) { $ this -> allMenuLinkRoutes [ 'PagesController' ] = Post :: getDefaultPostRoutes ( $ postType ) ; } continue ; } // Define postType route if not defined in its own Controller if ( Post :: haveItsOwnController ( $ postType -> slug ) ) { if ( ! isset ( $ this -> allMenuLinkRoutes [ $ postTypeControllerName ] [ 'post_type' ] [ $ postType -> slug ] ) ) { $ this -> allMenuLinkRoutes [ $ postTypeControllerName ] [ 'post_type' ] [ $ postType -> slug ] = Post :: getDefaultPostTypeRoutes ( $ postType ) ; } // default post routes if ( ! isset ( $ this -> allMenuLinkRoutes [ $ postTypeControllerName ] [ $ postType -> slug ] ) ) { $ this -> allMenuLinkRoutes [ $ postTypeControllerName ] [ $ postType -> slug ] = Post :: getDefaultPostRoutes ( $ postType ) ; } } else { // Define postType route if not defined in PostController // Default Post Type routes if ( ! isset ( $ this -> allMenuLinkRoutes [ 'PostController' ] [ 'post_type' ] [ $ postType -> slug ] ) ) { $ this -> allMenuLinkRoutes [ 'PostController' ] [ 'post_type' ] [ $ postType -> slug ] = Post :: getDefaultPostTypeRoutes ( $ postType ) ; } // default post routes if ( ! isset ( $ this -> allMenuLinkRoutes [ 'PostController' ] [ $ postType -> slug ] ) ) { $ this -> allMenuLinkRoutes [ 'PostController' ] [ $ postType -> slug ] = Post :: getDefaultPostRoutes ( $ postType ) ; } } } return $ this -> allMenuLinkRoutes ; }
Get all controllers' menuLinkRoutes.

@return array
@throws \Exception
Get all controllers menuLinkRoutes .