Illuminate\Routing\Router::setRoutes PHP Method

setRoutes() public method

Set the route collection instance.
public setRoutes ( Illuminate\Routing\RouteCollection $routes ) : void
$routes Illuminate\Routing\RouteCollection
return void
    public function setRoutes(RouteCollection $routes)
    {
        foreach ($routes as $route) {
            $route->setRouter($this)->setContainer($this->container);
        }
        $this->routes = $routes;
        $this->container->instance('routes', $this->routes);
    }

Usage Example

Example #1
0
 /**
  * Dispatch a request.
  *
  * @param \Illuminate\Http\Request $request
  * @param string                   $version
  *
  * @return mixed
  */
 public function dispatch(Request $request, $version)
 {
     if (!isset($this->routes[$version])) {
         throw new UnknownVersionException();
     }
     $routes = $this->mergeExistingRoutes($this->routes[$version]);
     $this->router->setRoutes($routes);
     return $this->router->dispatch($request);
 }
All Usage Examples Of Illuminate\Routing\Router::setRoutes