Route
class Route (View source)
Traits
Macroable |
RouteDependencyResolverTrait |
Properties
static protected array | $macros | The registered string macros. | from Macroable |
string | $uri | The URI pattern the route responds to. | |
array | $methods | The HTTP methods the route responds to. | |
array | $action | The route action array. | |
bool | $isFallback | Indicates whether the route is a fallback route. | |
mixed | $controller | The controller instance. | |
array | $defaults | The default values for the route. | |
array | $wheres | The regular expression requirements. | |
array | $parameters | The array of matched parameters. | |
array|null | $parameterNames | The parameter names for the route. | |
array|null | $computedMiddleware | The computed gathered middleware. | |
CompiledRoute | $compiled | The compiled version of the route. | |
protected Router | $router | The router instance used by the route. | |
protected Container | $container | The container instance used by the route. | |
static array | $validators | The validators used by the routes. |
Methods
static void | macro(string $name, object|callable $macro) Register a custom macro. | from Macroable |
static void | mixin(object $mixin) Mix another object into the class. | from Macroable |
static bool | hasMacro(string $name) Checks if macro is registered. | from Macroable |
static mixed | __callStatic(string $method, array $parameters) Dynamically handle calls to the class. | from Macroable |
mixed | __call(string $method, array $parameters) Dynamically handle calls to the class. | from Macroable |
array | resolveClassMethodDependencies(array $parameters, object $instance, string $method) Resolve the object method's type-hinted dependencies. | from RouteDependencyResolverTrait |
array | resolveMethodDependencies(array $parameters, ReflectionFunctionAbstract $reflector) Resolve the given method's type-hinted dependencies. | from RouteDependencyResolverTrait |
mixed | transformDependency(ReflectionParameter $parameter, array $parameters) Attempt to transform the given parameter into a class instance. | from RouteDependencyResolverTrait |
bool | alreadyInParameters(string $class, array $parameters) Determine if an object of the given class is in a list of parameters. | from RouteDependencyResolverTrait |
void | spliceIntoParameters(array $parameters, string $offset, mixed $value) Splice the given value into the parameter list. | from RouteDependencyResolverTrait |
void | __construct(array|string $methods, string $uri, Closure|array $action) Create a new Route instance. | |
array | parseAction(callable|array|null $action) Parse the route action into a standard array. | |
mixed | run() Run the route action and return the response. | |
bool | isControllerAction() Checks whether the route's action is a controller. | |
mixed | runCallable() Run the route action and return the response. | |
mixed | runController() Run the route action and return the response. | |
mixed | getController() Get the controller instance for the route. | |
string | getControllerMethod() Get the controller method used for the route. | |
array | parseControllerCallback() Parse the controller. | |
bool | matches(Request $request, bool $includingMethod = true) Determine if the route matches given request. | |
CompiledRoute | compileRoute() Compile the route into a Symfony CompiledRoute instance. | |
$this | bind(Request $request) Bind the route to a given request for execution. | |
bool | hasParameters() Determine if the route has parameters. | |
bool | hasParameter(string $name) Determine a given parameter exists from the route. | |
string|object | parameter(string $name, mixed $default = null) Get a given parameter from the route. | |
void | setParameter(string $name, mixed $value) Set a parameter to the given value. | |
void | forgetParameter(string $name) Unset a parameter on the route if it is set. | |
array | parameters() Get the key / value list of parameters for the route. | |
array | parametersWithoutNulls() Get the key / value list of parameters without null values. | |
array | parameterNames() Get all of the parameter names for the route. | |
array | compileParameterNames() Get the parameter names for the route. | |
array | signatureParameters(string|null $subClass = null) Get the parameters that are listed in the route / controller signature. | |
$this | defaults(string $key, mixed $value) Set a default value for the route. | |
$this | where(array|string $name, string $expression = null) Set a regular expression requirement on the route. | |
array | parseWhere(array|string $name, string $expression) Parse arguments to the where method into an array. | |
$this | whereArray(array $wheres) Set a list of regular expression requirements on the route. | |
$this | fallback() Mark this route as a fallback route. | |
array | methods() Get the HTTP verbs the route responds to. | |
bool | httpOnly() Determine if the route only responds to HTTP requests. | |
bool | httpsOnly() Determine if the route only responds to HTTPS requests. | |
bool | secure() Determine if the route only responds to HTTPS requests. | |
$this|string|null | domain(string|null $domain = null) Get or set the domain for the route. | |
string|null | getDomain() Get the domain defined for the route. | |
string | getPrefix() Get the prefix of the route instance. | |
$this | prefix(string $prefix) Add a prefix to the route URI. | |
string | uri() Get the URI associated with the route. | |
$this | setUri(string $uri) Set the URI that the route responds to. | |
string | getName() Get the name of the route instance. | |
$this | name(string $name) Add or change the route name. | |
bool | named(mixed ...$patterns) Determine whether the route's name matches the given patterns. | |
$this | uses(Closure|string $action) Set the handler for the route. | |
string | addGroupNamespaceToStringUses(string $action) Parse a string based action for the "uses" fluent method. | |
string | getActionName() Get the action name for the route. | |
string | getActionMethod() Get the method name of the route action. | |
mixed | getAction(string|null $key = null) Get the action array or one of its properties for the route. | |
$this | setAction(array $action) Set the action array for the route. | |
array | gatherMiddleware() Get all middleware, including the ones from the controller. | |
$this|array | middleware(array|string|null $middleware = null) Get or set the middlewares attached to the route. | |
array | controllerMiddleware() Get the middleware for the route's controller. | |
ControllerDispatcher | controllerDispatcher() Get the dispatcher for the route's controller. | |
static array | getValidators() Get the route validators for the instance. | |
CompiledRoute | getCompiled() Get the compiled version of the route. | |
$this | setRouter(Router $router) Set the router instance on the route. | |
$this | setContainer(Container $container) Set the container instance on the route. | |
void | prepareForSerialization() Prepare the route instance for serialization. | |
mixed | __get(string $key) Dynamically access route parameters. |
Details
static void macro(string $name, object|callable $macro)
Register a custom macro.
static void mixin(object $mixin)
Mix another object into the class.
static bool hasMacro(string $name)
Checks if macro is registered.
static mixed __callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
mixed __call(string $method, array $parameters)
Dynamically handle calls to the class.
protected array resolveClassMethodDependencies(array $parameters, object $instance, string $method)
Resolve the object method's type-hinted dependencies.
array resolveMethodDependencies(array $parameters, ReflectionFunctionAbstract $reflector)
Resolve the given method's type-hinted dependencies.
protected mixed transformDependency(ReflectionParameter $parameter, array $parameters)
Attempt to transform the given parameter into a class instance.
protected bool alreadyInParameters(string $class, array $parameters)
Determine if an object of the given class is in a list of parameters.
protected void spliceIntoParameters(array $parameters, string $offset, mixed $value)
Splice the given value into the parameter list.
void __construct(array|string $methods, string $uri, Closure|array $action)
Create a new Route instance.
protected array parseAction(callable|array|null $action)
Parse the route action into a standard array.
mixed run()
Run the route action and return the response.
protected bool isControllerAction()
Checks whether the route's action is a controller.
protected mixed runCallable()
Run the route action and return the response.
protected mixed runController()
Run the route action and return the response.
mixed getController()
Get the controller instance for the route.
protected string getControllerMethod()
Get the controller method used for the route.
protected array parseControllerCallback()
Parse the controller.
bool matches(Request $request, bool $includingMethod = true)
Determine if the route matches given request.
protected CompiledRoute compileRoute()
Compile the route into a Symfony CompiledRoute instance.
$this bind(Request $request)
Bind the route to a given request for execution.
bool hasParameters()
Determine if the route has parameters.
bool hasParameter(string $name)
Determine a given parameter exists from the route.
string|object parameter(string $name, mixed $default = null)
Get a given parameter from the route.
void setParameter(string $name, mixed $value)
Set a parameter to the given value.
void forgetParameter(string $name)
Unset a parameter on the route if it is set.
array parameters()
Get the key / value list of parameters for the route.
array parametersWithoutNulls()
Get the key / value list of parameters without null values.
array parameterNames()
Get all of the parameter names for the route.
protected array compileParameterNames()
Get the parameter names for the route.
array signatureParameters(string|null $subClass = null)
Get the parameters that are listed in the route / controller signature.
$this defaults(string $key, mixed $value)
Set a default value for the route.
$this where(array|string $name, string $expression = null)
Set a regular expression requirement on the route.
protected array parseWhere(array|string $name, string $expression)
Parse arguments to the where method into an array.
protected $this whereArray(array $wheres)
Set a list of regular expression requirements on the route.
$this fallback()
Mark this route as a fallback route.
array methods()
Get the HTTP verbs the route responds to.
bool httpOnly()
Determine if the route only responds to HTTP requests.
bool httpsOnly()
Determine if the route only responds to HTTPS requests.
bool secure()
Determine if the route only responds to HTTPS requests.
$this|string|null domain(string|null $domain = null)
Get or set the domain for the route.
string|null getDomain()
Get the domain defined for the route.
string getPrefix()
Get the prefix of the route instance.
$this prefix(string $prefix)
Add a prefix to the route URI.
string uri()
Get the URI associated with the route.
$this setUri(string $uri)
Set the URI that the route responds to.
string getName()
Get the name of the route instance.
$this name(string $name)
Add or change the route name.
bool named(mixed ...$patterns)
Determine whether the route's name matches the given patterns.
$this uses(Closure|string $action)
Set the handler for the route.
protected string addGroupNamespaceToStringUses(string $action)
Parse a string based action for the "uses" fluent method.
string getActionName()
Get the action name for the route.
string getActionMethod()
Get the method name of the route action.
mixed getAction(string|null $key = null)
Get the action array or one of its properties for the route.
$this setAction(array $action)
Set the action array for the route.
array gatherMiddleware()
Get all middleware, including the ones from the controller.
$this|array middleware(array|string|null $middleware = null)
Get or set the middlewares attached to the route.
array controllerMiddleware()
Get the middleware for the route's controller.
ControllerDispatcher controllerDispatcher()
Get the dispatcher for the route's controller.
static array getValidators()
Get the route validators for the instance.
CompiledRoute getCompiled()
Get the compiled version of the route.
$this setRouter(Router $router)
Set the router instance on the route.
$this setContainer(Container $container)
Set the container instance on the route.
void prepareForSerialization()
Prepare the route instance for serialization.
mixed __get(string $key)
Dynamically access route parameters.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.7/Illuminate/Routing/Route.html