/** * 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); }
/** * 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->mergeOldRoutes($version); $this->router->setRoutes($routes); $router = clone $this->router; $response = $router->dispatch($request); unset($router); return $response; }
/** * 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(); } $this->router->setRoutes($this->routes[$version]); // Because the above call will reset the routes defined on the applications // UrlGenerator we will simply rebind the routes to the application // container which will trigger the rebinding event. $this->container->instance('routes', $this->applicationRoutes); return $this->router->dispatch($request); }
/** * Set the route collection instance. * * @param \Illuminate\Routing\RouteCollection $routes * @return void * @static */ public static function setRoutes($routes) { \Illuminate\Routing\Router::setRoutes($routes); }
/** * registerRouteCollection * * @param Router $router to register macro * * @return void */ protected function registerRouteCollection(Router $router) { $router->setRoutes(new RouteCollection()); }