@param IRouter $router

@return array
548983
private function gatherFacts(IRouter $router) {
        $facts = [];

        foreach ($router->getRoutesMatcher()->getFiltersMatcher()->getFilters() as $filter) {
            $filters[] = $filter->getName();
        }

        foreach ($router->getRoutes() as $route) {
            $filters = [];

            foreach ($router->getRoutesMatcher()->getFiltersMatcher()->getFilters() as $filter) {
                if ($filter->isEnabled()) {
                    $filters[] = $filter->getName();
                }
            }

            $facts[] = [
                'filters' => $filters,
                'hosts' => $router->getRoutesMatcher()->getRestrictionsMatcher()->getHosts(),
                'domains' => $router->getRoutesMatcher()->getRestrictionsMatcher()->getDomains(),
                'subdomains' => $router->getRoutesMatcher()->getRestrictionsMatcher()->getSubdomains(),
                'protocols' => $router->getRoutesMatcher()->getRestrictionsMatcher()->getProtocols(),
                'tlds' => $router->getRoutesMatcher()->getRestrictionsMatcher()->getTLDs(),
                'methods' => $route->getMethods(),
                'path' => $route->getPath(),
            ];
        }

        foreach ($router->getNestedRouters() as $router) {
            $facts = array_merge($facts, $this->gatherFacts($router));
        }

        return $facts;
    }
745998
public function map(Router $router)
    {
        /** @var Tenant $tenant */
        $tenant = $this->app->make('auth.tenant');
        $router->group(
            ['namespace' => $this->namespace],
            function ($router) use ($tenant) {
                $tries = ['routes'];

                if ($tenant->getTenantOwner() instanceof DomainAwareTenantParticipant) {
                    array_unshift($tries, $tenant->getTenantOwner()->getDomain());
                }
                if ($tenant->getTenantCreator() instanceof DomainAwareTenantParticipant) {
                    array_unshift($tries, $tenant->getTenantCreator()->getDomain());
                }

                foreach ($tries as $file) {
                    $path = app_path(sprintf('Http/%s.php', $file));
                    if (file_exists($path)) {
                        require_once $path;
                        return;
                    }
                }

                throw new \RuntimeException('No routes found in: ' . implode(', ', $tries));
            }
        );
    }
919567
public function createDefaultPageRoutes(IRouter $routes, string $url): void
	{
		if ($this->configurator->onePage) {
			$routes[] = new Route($url, $this->onePageLink);
			$routes[] = new Route($url . 'index.php', $this->onePageLink, Route::ONE_WAY);
			$routes[] = new Route($url . '<presenter>[/<action>]', $this->defaultLink);

		} else {
			$routes[] = new Route($url, $this->defaultLink);
			$routes[] = new Route($url . 'index.php', $this->defaultLink, Route::ONE_WAY);
			$routes[] = new Route($url . '<presenter>[/<action>]', $this->defaultLink);
		}
	}
703231
public function map(Router $router)
    {
        $router->group($this->routeAttributes(), function(Router $router) {
            LogViewerRoute::register($router);
        });
    }
572645
public function mapApiRoutes(Router $router)
    {
        $permissionPrefix = $this->routeHelper->getPermissionPrefixForModelSlug(
            $this->getModelSlug()
        );

        $router->group(
            [
                'prefix'     => $this->getRoutePrefix(),
                'as'         => $this->getRouteNamePrefix(),
                'middleware' => [ cms_mw_permission("{$permissionPrefix}*") ],
            ],
            function (Router $router) use ($permissionPrefix) {

                $controller = $this->getModelApiController();

                $router->get('/', [
                    'as'   => 'index',
                    'uses' => $controller . '@index',
                ]);

                $router->get('create', [
                    'as'         => 'create',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}create")],
                    'uses'       => $controller . '@create',
                ]);

                $router->post('/', [
                    'as'         => 'store',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}create")],
                    'uses'       => $controller . '@store',
                ]);

                $router->get('{key}', [
                    'as'   => 'show',
                    'uses' => $controller . '@show',
                ]);

                $router->get('{key}/edit', [
                    'as'         => 'edit',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}edit")],
                    'uses'       => $controller . '@edit',
                ]);

                $router->put('{key}', [
                    'as'         => 'update',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}edit")],
                    'uses'       => $controller . '@update',
                ]);

                $router->delete('{key}', [
                    'as'         => 'destroy',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}delete")],
                    'uses'       => $controller . '@destroy',
                ]);
            }
        );
    }
1022217
protected function dispatchToRouter()
    {
        return function ($request) {
            $this->app->instance('request', $request);

            return $this->router->dispatch($request);
        };
    }
952956
public function router($Router = [])
    {
        /**
         * 'Controller'=> 'Home',
         * 'Mothed'    => 'Mothed',
         * 'Params'    => 'Params',
         */
        $this->_controller = $Router['controller'] ? ucfirst($Router['controller']) : 'Home';
        $this->_mothed = $Router['mothed'] ? ucfirst($Router['mothed']) : 'Index';
        $this->_params = $Router['params'] ? ucfirst($Router['params']) : '';
        return $this;
    }
35865
public function mapWebRoutes(Router $router)
    {
        $permissionPrefix = $this->routeHelper->getPermissionPrefixForModelSlug(
            $this->getModelSlug()
        );

        $router->group(
            [
                'prefix'    => $this->getRoutePrefix(),
                'as'        => $this->getRouteNamePrefix(),
                'middleware' => [ cms_mw_permission("{$permissionPrefix}*") ],
            ],
            function (Router $router) use ($permissionPrefix) {

                $controller = $this->getModelWebController();

                $router->get('/', [
                    'as'   => 'index',
                    'uses' => $controller . '@index',
                ]);

                $router->get('create', [
                    'as'         => 'create',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}create")],
                    'uses'       => $controller . '@create',
                ]);

                $router->post('/', [
                    'as'         => 'store',
                    'middleware' => [
                        cms_mw_permission("{$permissionPrefix}create"),
                        StoreActiveFormContext::class,
                    ],
                    'uses'       => $controller . '@store',
                ]);

                $router->post('filter', [
                    'as'   => 'filter',
                    'uses' => $controller . '@filter',
                ]);

                $router->get('export/{strategy}', [
                    'as'         => 'export',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}export")],
                    'uses'       => $controller . '@export',
                ]);

                $router->get('{key}', [
                    'as'   => 'show',
                    'uses' => $controller . '@show',
                ]);

                $router->get('{key}/edit', [
                    'as'         => 'edit',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}edit")],
                    'uses'       => $controller . '@edit',
                ]);

                $router->put('{key}/activate', [
                    'as'         => 'activate',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}edit")],
                    'uses'       => $controller . '@activate',
                ]);

                $router->put('{key}/position', [
                    'as'         => 'position',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}edit")],
                    'uses'       => $controller . '@position',
                ]);

                $router->get('{key}/deletable', [
                    'as'         => 'deletable',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}delete")],
                    'uses'       => $controller . '@deletable',
                ]);

                $router->put('{key}', [
                    'as'         => 'update',
                    'middleware' => [
                        cms_mw_permission("{$permissionPrefix}edit"),
                        StoreActiveFormContext::class,
                    ],
                    'uses'       => $controller . '@update',
                ]);

                $router->delete('{key}', [
                    'as'         => 'destroy',
                    'middleware' => [cms_mw_permission("{$permissionPrefix}delete")],
                    'uses'       => $controller . '@destroy',
                ]);
            }
        );
    }
1049281
public function applyFilters(IRoute $route) {
        foreach ($this->getFilters() as $filter) {
            if ($filter->isEnabled()) {
                $invoker = $this->getFilterInvoker();
                $result = $invoker->invoke($filter->getFilter(), $route);

                if (is_bool($result)) {
                    return $result;
                }
            }
        }

        return true;
    }
509248
protected function getRouteInformation(Route $route)
    {
        if ($route->getName()) {
            return [
                'uri'    => $route->uri(),
                'name'   => $route->getName(),
                'before' => $this->getBeforeFilters($route),
            ];
        }

        return null;
    }
260445
protected function getInternalDomains()
    {
        $internalDomains = [];

        $routes = $this->grabService('router')->getRouteCollection();
        /* @var \Symfony\Component\Routing\Route $route */
        foreach ($routes as $route) {
            if (!is_null($route->getHost())) {
                $compiled = $route->compile();
                if (!is_null($compiled->getHostRegex())) {
                    $internalDomains[] = $compiled->getHostRegex();
                }
            }
        }

        return array_unique($internalDomains);
    }
953717
public final function getPageList($render, $options) {
        $info = Router::getRouter()->getParsedInfo();
        if (is_null($this->countTotal)) {
            $this->countTotal = $info->total;
        }
        if ($this->countTotal > 0) {
            $paging_data = apply_filter('on_render_paging_by_' . $render, [], $info, $options);
            if (empty ($paging_data)) {
                $paging_data = $this->getPageInfo($info, $this->countTotal, $options);
            }

            return $paging_data;
        } else {
            return [];
        }
    }
676138
protected function mapArticleRoutes(Router $router)
    {
        try {
            /** @var \Yajra\CMS\Repositories\Article\Repository $repository */
            $repository = app('articles');
            $repository->getAllPublished()->each(function (Article $article) use ($router) {
                $middleware = ['web'];
                if ($article->requiresAuthentication()) {
                    $middleware[] = 'auth';
                }

                if ($article->permissions->count()) {
                    if ($article->authorization === 'can') {
                        $article->permissions->each(
                            function (Permission $permission) use ($middleware) {
                                $middleware[] = 'can:' . $permission->slug;
                            }
                        );
                    } else {
                        $abilities    = $article->permissions->pluck('slug')->toArray();
                        $middleware[] = 'canAtLeast:' . implode(',', $abilities);
                    }
                }

                if ($article->hasTheme()) {
                    $middleware[] = 'theme:' . $article->getTheme();
                }

                $router->get($article->present()->slug,
                    function () use ($article, $router) {
                        return $this->app->call(ArticleController::class . '@show', [
                            'id'         => $article->id,
                            'parameters' => $router->current()->parameters(),
                        ]);
                    })->middleware($middleware)->name($article->getRouteName());

                /** @var \DaveJamesMiller\Breadcrumbs\BreadcrumbsManager $breadcrumb */
                $breadcrumb = resolve(BreadcrumbsManager::class);
                $breadcrumb->register($article->getRouteName(),
                    function (BreadcrumbsGenerator $breadcrumbs) use ($article) {
                        if ($article->is_page) {
                            $breadcrumbs->parent('home');
                        } else {
                            $breadcrumbs->parent($article->category->getRouteName());
                        }
                        $breadcrumbs->push($article->title, route($article->getRouteName()));
                    }
                );
            });
        } catch (QueryException $e) {
            // \\_(",)_//
        }
    }
499633
private function getRouteRoles()
    {
        $router = $this->router;

        $cache = $this->getConfigCacheFactory()->cache(
            $this->options['cache_dir'].'/tenside_roles.php',
            function (ConfigCacheInterface $cache) use ($router) {
                $routes = $router->getRouteCollection();
                $roles  = [];
                foreach ($routes as $name => $route) {
                    if ($requiredRole = $route->getOption('required_role')) {
                        $roles[$name] = $requiredRole;
                    }
                }

                $cache->write('<?php return ' . var_export($roles, true) . ';', $routes->getResources());
            }
        );

        return require_once $cache->getPath();
    }
845991
public function map(Router $router)
    {
        $router->bind('widget', function ($id) use ($router) {
            if ($router->is(admin_prefix() . '*')) {
                return Widget::withoutGlobalScope('menu_assignment')->findOrFail($id);
            }

            return Widget::findOrFail($id);
        });

        $this->mapWebRoutes($router);
    }
61608
public function getRouter(string $router): RouterAbstract
    {
        if (!array_key_exists($router, $this->_routers))
            $this->_routers[$router] = $this->getItem($router);

        return $this->_routers[$router];
    }
949698
public function createPageRoute(IRouter $routes, string $url): void
	{
		list($presenter, $action) = explode(':', $this->pageLink);

		$routes[] = new Route($url . '[<url .*>]', [
			'presenter' => $presenter,
			'action' => $action,
			null => [
				Route::FILTER_IN => function ($params) {
					if ($this->orm->pages->exists($params['url'])) {
						return $params;
					}
					return null;
				}
			],
		]);
	}