resetRoutes example


    protected function withRoutes(?array $routes = null)
    {
        $collection = Services::routes();

        if ($routes) {
            $collection->resetRoutes();

            foreach ($routes as $route) {
                if (isset($route[3])) {
                    $collection->{$route[0]}($route[1]$route[2]$route[3]);
                } else {
                    $collection->{$route[0]}($route[1]$route[2]);
                }
            }
        }

        $this->routes = $collection;

        
$finder = new FilterFinder($router$filters);

        return $finder->find($uri);
    }

    private function createRouter(Request $request): Router
    {
        $routes = Services::routes();

        if ($this->resetRoutes) {
            $routes->resetRoutes();
        }

        return new Router($routes$request);
    }

    private function createFilters(Request $request): Filters
    {
        $config = config(FiltersConfig::class);

        return new Filters($config$request, Services::response());
    }
}

    protected function withRoutes(?array $routes = null)
    {
        $collection = Services::routes();

        if ($routes) {
            $collection->resetRoutes();

            foreach ($routes as $route) {
                $collection->{$route[0]}($route[1]$route[2]);
            }
        }

        $this->routes = $collection;

        return $this;
    }

    
Home | Imprint | This part of the site doesn't use cookies.