Route
class Route (View source)
Traits
RouteDependencyResolverTrait |
Properties
protected string | $uri | The URI pattern the route responds to. | |
protected array | $methods | The HTTP methods the route responds to. | |
protected array | $action | The route action array. | |
protected array | $defaults | The default values for the route. | |
protected array | $wheres | The regular expression requirements. | |
protected array | $parameters | The array of matched parameters. | |
protected array|null | $parameterNames | The parameter names for the route. | |
protected CompiledRoute | $compiled | The compiled version of the route. | |
protected Container | $container | The container instance used by the route. | |
static array | $validators | The validators used by the routes. |
Methods
mixed | callWithDependencies(object $instance, string $method) Call a class method with the resolved dependencies. | from RouteDependencyResolverTrait |
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, array $originalParameters) Attempt to transform the given parameter into a class instance. | from RouteDependencyResolverTrait |
bool | vacantEloquentParameter(ReflectionClass $class, array $parameters) Determine if the given type-hinted class is an implict Eloquent binding. | from RouteDependencyResolverTrait |
mixed | extractModelIdentifier(ReflectionParameter $parameter, array $originalParameters) Extract an implicit model binding's key out of the parameter list. | 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 $key, mixed $instance) Splice the given value into the parameter list. | from RouteDependencyResolverTrait |
void | __construct(array $methods, string $uri, Closure|array $action) Create a new Route instance. | |
mixed | run(Request $request) Run the route action and return the response. | |
mixed | runCallable(Request $request) Run the route action and return the response. | |
mixed | runController(Request $request) Run the route action and return the response. | |
bool | customDispatcherIsBound() Determine if a custom route dispatcher is bound in the container. | |
mixed | runWithCustomDispatcher(Request $request) Send the request and route to a custom dispatcher for handling. | |
bool | matches(Request $request, bool $includingMethod = true) Determine if the route matches given request. | |
void | compileRoute() Compile the route into a Symfony CompiledRoute instance. | |
array | extractOptionalParameters() Get the optional parameters for the route. | |
$this|array | middleware(array|string|null $middleware = null) Get or set the middlewares attached to the route. | |
array | beforeFilters() deprecated Get the "before" filters for the route. | |
array | afterFilters() deprecated Get the "after" filters for the route. | |
static array | parseFilters(string $filters) deprecated Parse the given filter string. | |
static array | explodeFilters(array|string $filters) Turn the filters into an array if they aren't already. | |
static array | explodeArrayFilters(array $filters) Flatten out an array of filter declarations. | |
static array | parseFilter(string $filter) deprecated Parse the given filter into name and parameters. | |
static array | parseParameterFilter(string $filter) Parse a filter with parameters. | |
bool | hasParameter(string $name) Determine a given parameter exists from the route. | |
string|object | getParameter(string $name, mixed $default = null) Get a given parameter 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. | |
$this | bind(Request $request) Bind the route to a given request for execution. | |
array | bindParameters(Request $request) Extract the parameter list from the request. | |
array | bindPathParameters(Request $request) Get the parameter matches for the path portion of the URI. | |
array | bindHostParameters(Request $request, array $parameters) Extract the parameter list from the host part of the request. | |
array | matchToKeys(array $matches) Combine a set of parameter matches with the route's keys. | |
array | replaceDefaults(array $parameters) Replace null parameters with their defaults. | |
array | parseAction(callable|array $action) Parse the route action into a standard array. | |
callable | findCallable(array $action) Find the callable in an action array. | |
static array | getValidators() Get the route validators for the instance. | |
$this | before(string $filters) deprecated Add before filters to the route. | |
$this | after(string $filters) deprecated Add after filters to the route. | |
$this | addFilters(string $type, string $filters) Add the given filters to the route by type. | |
$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 | prefix(string $prefix) Add a prefix to the route URI. | |
string | getPath() Get the URI associated with the route. | |
string | uri() Get the URI associated with the route. | |
array | getMethods() Get the HTTP verbs the route responds to. | |
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. | |
string|null | domain() Get the domain defined for the route. | |
string | getUri() Get the URI that the route responds to. | |
Route | setUri(string $uri) Set the URI that the route responds to. | |
string | getPrefix() Get the prefix of the route instance. | |
string | getName() Get the name of the route instance. | |
$this | name(string $name) Add or change the route name. | |
string | getActionName() Get the action name for the route. | |
array | getAction() Get the action array for the route. | |
$this | setAction(array $action) Set the action array for the route. | |
CompiledRoute | getCompiled() Get the compiled version of 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
protected mixed callWithDependencies(object $instance, string $method)
Call a class method with the resolved dependencies.
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, array $originalParameters)
Attempt to transform the given parameter into a class instance.
protected bool vacantEloquentParameter(ReflectionClass $class, array $parameters)
Determine if the given type-hinted class is an implict Eloquent binding.
Must not already be resolved in the parameter list by an explicit model binding.
protected mixed extractModelIdentifier(ReflectionParameter $parameter, array $originalParameters)
Extract an implicit model binding's key out of the parameter list.
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 $key, mixed $instance)
Splice the given value into the parameter list.
void __construct(array $methods, string $uri, Closure|array $action)
Create a new Route instance.
mixed run(Request $request)
Run the route action and return the response.
protected mixed runCallable(Request $request)
Run the route action and return the response.
protected mixed runController(Request $request)
Run the route action and return the response.
protected bool customDispatcherIsBound()
Determine if a custom route dispatcher is bound in the container.
protected mixed runWithCustomDispatcher(Request $request)
Send the request and route to a custom dispatcher for handling.
bool matches(Request $request, bool $includingMethod = true)
Determine if the route matches given request.
protected void compileRoute()
Compile the route into a Symfony CompiledRoute instance.
protected array extractOptionalParameters()
Get the optional parameters for the route.
$this|array middleware(array|string|null $middleware = null)
Get or set the middlewares attached to the route.
array beforeFilters() deprecated
deprecated
Get the "before" filters for the route.
array afterFilters() deprecated
deprecated
Get the "after" filters for the route.
static array parseFilters(string $filters) deprecated
deprecated
Parse the given filter string.
static protected array explodeFilters(array|string $filters)
Turn the filters into an array if they aren't already.
static protected array explodeArrayFilters(array $filters)
Flatten out an array of filter declarations.
static array parseFilter(string $filter) deprecated
deprecated
Parse the given filter into name and parameters.
static protected array parseParameterFilter(string $filter)
Parse a filter with parameters.
bool hasParameter(string $name)
Determine a given parameter exists from the route.
string|object getParameter(string $name, mixed $default = null)
Get a given parameter 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.
$this bind(Request $request)
Bind the route to a given request for execution.
array bindParameters(Request $request)
Extract the parameter list from the request.
protected array bindPathParameters(Request $request)
Get the parameter matches for the path portion of the URI.
protected array bindHostParameters(Request $request, array $parameters)
Extract the parameter list from the host part of the request.
protected array matchToKeys(array $matches)
Combine a set of parameter matches with the route's keys.
protected array replaceDefaults(array $parameters)
Replace null parameters with their defaults.
protected array parseAction(callable|array $action)
Parse the route action into a standard array.
protected callable findCallable(array $action)
Find the callable in an action array.
static array getValidators()
Get the route validators for the instance.
$this before(string $filters) deprecated
deprecated
Add before filters to the route.
$this after(string $filters) deprecated
deprecated
Add after filters to the route.
protected $this addFilters(string $type, string $filters)
Add the given filters to the route by type.
$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 prefix(string $prefix)
Add a prefix to the route URI.
string getPath()
Get the URI associated with the route.
string uri()
Get the URI associated with the route.
array getMethods()
Get the HTTP verbs the route responds to.
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.
string|null domain()
Get the domain defined for the route.
string getUri()
Get the URI that the route responds to.
Route setUri(string $uri)
Set the URI that the route responds to.
string getPrefix()
Get the prefix of the route instance.
string getName()
Get the name of the route instance.
$this name(string $name)
Add or change the route name.
string getActionName()
Get the action name for the route.
array getAction()
Get the action array for the route.
$this setAction(array $action)
Set the action array for the route.
CompiledRoute getCompiled()
Get the compiled version of 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.1/Illuminate/Routing/Route.html