Register a new GET route with the router.

@param string                $uri
@param \Closure|array|string $action

@return \Illuminate\Routing\Route
559475
public function get($uri, $action)
    {
        $uri = $this->buildUri($uri);

        return $this->addResponseType(Route::get($uri, $action));
    }
788476
public function post(string $uri, $action): self
    {
        $this->routes['POST'][$this->trimTrailingSlashes($uri)] = $action;

        return $this;
    }
1136337
protected function createRoute($methods, $uri, $action)
    {
        if (is_callable($action)) {
            $action = array('uses' => $action);
        }

        // If the route is routing to a controller we will parse the route action into
        // an acceptable array format before registering it and creating this route
        // instance itself. We need to build the Closure that will call this out.
        else if ($this->actionReferencesController($action)) {
            $action = $this->convertToControllerAction($action);
        }

        // If no "uses" property has been set, we will dig through the array to find a
        // Closure instance within this list. We will set the first Closure we come
        // across into the "uses" property that will get fired off by this route.
        else if (! isset($action['uses'])) {
            $action['uses'] = $this->findActionClosure($action);
        }

        if (isset($action['middleware']) && is_string($action['middleware'])) {
            $action['middleware'] = explode('|', $action['middleware']);
        }

        $route = $this->newRoute(
            $methods, $uri = $this->prefix($uri), $action
        );

        // If we have groups that need to be merged, we will merge them now after this
        // route has already been created and is ready to go. After we're done with
        // the merge we will be ready to return the route back out to the caller.
        if (! empty($this->groupStack)) {
            $this->mergeGroupAttributesIntoRoute($route);
        }

        $this->addWhereClausesToRoute($route);

        return $route;
    }
811207
protected function newRoute($methods, $uri, $action)
    {
        return with(new Route($methods, $uri, $action))
            ->setRouter($this)
            ->setContainer($this->container);
    }
71909
public function any( $uri, $action = null )
	{
		$verbs = ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE'];

		return $this->addRoute( $verbs, $uri, $action );
	}
916181
public function any($uri, $action)
    {
        $uri = $this->buildUri($uri);

        return Route::any($uri, $action);
    }
1076163
public function addInternal($rule, $action = null)
    {
        $route = $this->di->get('route');
        $route->set($rule, $action);
        $this->internalRoutes[$rule] = $route;
        return $route;
    }
840302
public function dispatch($action, array $parameters = [])
    {
        $parameters['key'] = $this->config('public_key');
        $parameters['sum'] = $this->summary(array_merge($parameters, [
            'action'  => $action,
            'version' => self::VERSION,
        ]));
        $uri = (new UriTemplate())->expand(self::HOST.'{/segments*}{?parameters*}', [
            'segments'   => [
                self::VERSION, $action,
            ],
            'parameters' => $parameters,
        ]);

        return (new Client())->get($uri);
    }
707450
protected function uriGenerator($controllerAction)
    {
        /** @var array $routes */
        $routes = Application::getInstance()->getRoutes();
        foreach ($routes as $route) {
            if ($route['action'] === $controllerAction) {
                return $route;
            }
        }
    }
1331804
public static function parse($uri, $action)
    {
        // If no action is passed in right away, we assume the user will make use of
        // fluent routing. In that case, we set a default closure, to be executed
        // if the user never explicitly sets an action to handle the given uri.
        if (is_null($action)) {
            return static::missingAction($uri);
        }

        // If the action is already a Closure instance, we will just set that instance
        // as the "uses" property, because there is nothing else we need to do when
        // it is available. Otherwise we will need to find it in the action list.
        if (is_callable($action, true)) {
            return ! is_array($action) ? ['uses' => $action] : [
                'uses' => $action[0].'@'.$action[1],
                'controller' => $action[0].'@'.$action[1],
            ];
        }

        // If no "uses" property has been set, we will dig through the array to find a
        // Closure instance within this list. We will set the first Closure we come
        // across into the "uses" property that will get fired off by this route.
        elseif (! isset($action['uses'])) {
            $action['uses'] = static::findCallable($action);
        }

        if (is_string($action['uses']) && ! Str::contains($action['uses'], '@')) {
            $action['uses'] = static::makeInvokable($action['uses']);
        }

        return $action;
    }
942461
public function addRoute($methods, $uri, $action)
    {
        // We do not keep routes in ApiRouter. Whenever a route is added,
        // we add it to Laravel's primary route collection
        $routes = app("router")->getRoutes();
        $prefix = config("api.prefix");

        if (empty($this->versions)) {
            if (($default = config("api.default_version")) !== null) {
                $versions = [$default];
            }
            else {
                $versions = [null];
            }

        }
        else {
            $versions = $this->versions;
        }


        // Add version prefix
        foreach ($versions as $version) {
            // Add ApiMiddleware to all routes
            $route = $this->createRoute($methods, $uri, $action);
            $route->middleware(ApiMiddleware::class);

            if ($version !== null) {
                $route->prefix($version);
                $route->name("." . $version);
            }

            if (!empty($prefix)) {
                $route->prefix($prefix);
            }

            $routes->add($route);

            // Options route
            $route = $this->createRoute(['OPTIONS'], $uri, function () {
                return [];
            });

            $route->middleware(ApiMiddleware::class);

            if ($version !== null) {
                $route->prefix($version);
                $route->name("." . $version);
            }

            if (!empty($prefix)) {
                $route->prefix($prefix);
            }

            $routes->add($route);
        }

        app("router")->setRoutes($routes);
    }
968703
public function all($uri, $action = null)
    {
        $verbs = ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE'];

        return $this->addRoute($verbs, $uri, $action);
    }
523823
public function delete($uri, $action)
    {
        $uri = $this->buildUri($uri);

        return $this->addResponseType(Route::delete($uri, $action));
    }
1126751
public function addRoute(array $methods, array $versions, $uri, $action)
    {
        $this->createRouteCollections($versions);

        foreach ($versions as $version) {
            foreach ($this->breakUriSegments($uri) as $uri) {
                $this->routes[$version]->addRoute($methods, $uri, $action);
            }
        }
    }
1102054
public function put($uri, $action)
    {
        $uri = $this->buildUri($uri);

        return $this->addResponseType(Route::put($uri, $action));
    }
779661
public function addRoute(string $path, string $controller, string $action = 'index', string $method = Request::METHOD_GET) : self
    {
        $endPoint = new RouteEndpoint($this->namespace, $controller, $action, $method);
        $this->routes[] = new Route($path, $endPoint);
        
        return $this;
    }
1182580
public function options($uri, $action)
    {
        $uri = $this->buildUri($uri);

        return $this->addResponseType(Route::options($uri, $action));
    }