Route
class Route (View source)
Traits
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|null | $parameters | The array of matched parameters. |
|
array|null | $parameterNames | The parameter names for the route. |
|
protected array | $originalParameters | The array of the matched parameters' original values. |
|
protected bool | $withTrashedBindings | Indicates "trashed" models can be retrieved when resolving implicit model bindings for this route. |
|
protected int|null | $lockSeconds | Indicates the maximum number of seconds the route should acquire a session lock for. |
|
protected int|null | $waitSeconds | Indicates the maximum number of seconds the route should wait while attempting to acquire a session lock. |
|
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. |
|
protected array | $bindingFields | The fields that implicit binding should use for a given parameter. |
|
static array | $validators | The validators used by the routes. |
Methods
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Specify that the given route parameters must be alphabetic.
Specify that the given route parameters must be alphanumeric.
Specify that the given route parameters must be numeric.
Specify that the given route parameters must be ULIDs.
Specify that the given route parameters must be UUIDs.
Specify that the given route parameters must be one of the given values.
Apply the given regular expression to the given parameters.
Determine if the given options exclude a particular method.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Resolve the object method's type-hinted dependencies.
Resolve the given method's type-hinted dependencies.
Attempt to transform the given parameter into a class instance.
Determine if an object of the given class is in a list of parameters.
Splice the given value into the parameter list.
Parse the route action into a standard array.
Run the route action and return the response.
Checks whether the route's action is a controller.
Run the route action and return the response.
Determine if the route action is a serialized Closure.
Run the route action and return the response.
Get the controller instance for the route.
Get the controller class used for the route.
Get the controller method used for the route.
Parse the controller.
Flush the cached container instance on the route.
Compile the route into a Symfony CompiledRoute instance.
Determine if the route has parameters.
Determine a given parameter exists from the route.
Get a given parameter from the route.
Get original value of a given parameter from the route.
Set a parameter to the given value.
Unset a parameter on the route if it is set.
Get the key / value list of parameters for the route.
Get the key / value list of original parameters for the route.
Get the key / value list of parameters without null values.
Get all of the parameter names for the route.
Get the parameter names for the route.
Get the parameters that are listed in the route / controller signature.
Get the binding field for the given parameter.
Get the binding fields for the route.
Set the binding fields for the route.
Get the parent parameter of the given parameter.
Allow "trashed" models to be retrieved when resolving implicit model bindings for this route.
Determines if the route allows "trashed" models to be retrieved when resolving implicit model bindings.
Set a default value for the route.
Set the default values for the route.
Set a regular expression requirement on the route.
Parse arguments to the where method into an array.
Set a list of regular expression requirements on the route.
Mark this route as a fallback route.
Set the fallback value.
Get the HTTP verbs the route responds to.
Determine if the route only responds to HTTP requests.
Determine if the route only responds to HTTPS requests.
Determine if the route only responds to HTTPS requests.
Get or set the domain for the route.
Get the domain defined for the route.
Get the prefix of the route instance.
Add a prefix to the route URI.
Update the "prefix" attribute on the action array.
Get the URI associated with the route.
Set the URI that the route responds to.
Parse the route URI and normalize / store any implicit binding fields.
Get the name of the route instance.
Add or change the route name.
Determine whether the route's name matches the given patterns.
Parse a string based action for the "uses" fluent method.
Get the action name for the route.
Get the method name of the route action.
Get the action array or one of its properties for the route.
Set the action array for the route.
Get the value of the action that should be taken on a missing model exception.
Get all middleware, including the ones from the controller.
Get or set the middlewares attached to the route.
Specify that the "Authorize" / "can" middleware should be applied to the route with the given options.
Get the middleware for the route's controller.
Get the statically provided controller middleware for the given class and method.
Specify middleware that should be removed from the given route.
Get the middleware that should be removed from the route.
Indicate that the route should enforce scoping of multiple implicit Eloquent bindings.
Indicate that the route should not enforce scoping of multiple implicit Eloquent bindings.
Determine if the route should enforce scoping of multiple implicit Eloquent bindings.
Determine if the route should prevent scoping of multiple implicit Eloquent bindings.
Specify that the route should not allow concurrent requests from the same session.
Specify that the route should allow concurrent requests from the same session.
Get the maximum number of seconds the route's session lock should be held for.
Get the maximum number of seconds to wait while attempting to acquire a session lock.
Get the dispatcher for the route's controller.
Get the route validators for the instance.
Convert the route to a Symfony route.
Get the optional parameter names for the route.
Get the compiled version of the route.
Prepare the route instance for serialization.
Dynamically access route parameters.
Details
$this|TWhenReturnType
when($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
$this|TUnlessReturnType
unless($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
$this
whereAlpha(array|string $parameters)
Specify that the given route parameters must be alphabetic.
$this
whereAlphaNumeric(array|string $parameters)
Specify that the given route parameters must be alphanumeric.
$this
whereNumber(array|string $parameters)
Specify that the given route parameters must be numeric.
$this
whereIn(array|string $parameters, array $values)
Specify that the given route parameters must be one of the given values.
protected $this
assignExpressionToParameters(array|string $parameters, string $expression)
Apply the given regular expression to the given parameters.
static bool
methodExcludedByOptions(string $method, array $options)
Determine if the given options exclude a particular method.
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, object $skippableValue)
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.
protected array
parseAction(callable|array|null $action)
Parse the route action into a standard array.
bool
matches(Request $request, bool $includingMethod = true)
Determine if the route matches a given request.
string|object|null
parameter(string $name, string|object|null $default = null)
Get a given parameter from the route.
string|null
originalParameter(string $name, string|null $default = null)
Get original value of a given parameter from the route.
array
signatureParameters(array $conditions = [])
Get the parameters that are listed in the route / controller signature.
$this
withTrashed(bool $withTrashed = true)
Allow "trashed" models to be retrieved when resolving implicit model bindings for this route.
bool
allowsTrashedBindings()
Determines if the route allows "trashed" models to be retrieved when resolving implicit model bindings.
$this
where(array|string $name, string|null $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.
$this|string|null
domain(BackedEnum|string|null $domain = null)
Get or set the domain for the route.
protected void
updatePrefixOnAction(string $prefix)
Update the "prefix" attribute on the action array.
protected string
parseUri(string $uri)
Parse the route URI and normalize / store any implicit binding fields.
protected string
addGroupNamespaceToStringUses(string $action)
Parse a string based action for the "uses" fluent method.
mixed
getAction(string|null $key = null)
Get the action array or one of its properties for the route.
Closure|null
getMissing()
Get the value of the action that should be taken on a missing model exception.
$this
missing(Closure $missing)
Define the callable that should be invoked on a missing model exception.
$this|array
middleware(array|string|null $middleware = null)
Get or set the middlewares attached to the route.
$this
can(UnitEnum|string $ability, array|string $models = [])
Specify that the "Authorize" / "can" middleware should be applied to the route with the given options.
protected array
staticallyProvidedControllerMiddleware(string $class, string $method)
Get the statically provided controller middleware for the given class and method.
$this
withoutMiddleware(array|string $middleware)
Specify middleware that should be removed from the given route.
$this
scopeBindings()
Indicate that the route should enforce scoping of multiple implicit Eloquent bindings.
$this
withoutScopedBindings()
Indicate that the route should not enforce scoping of multiple implicit Eloquent bindings.
bool
enforcesScopedBindings()
Determine if the route should enforce scoping of multiple implicit Eloquent bindings.
bool
preventsScopedBindings()
Determine if the route should prevent scoping of multiple implicit Eloquent bindings.
$this
block(int|null $lockSeconds = 10, int|null $waitSeconds = 10)
Specify that the route should not allow concurrent requests from the same session.
$this
withoutBlocking()
Specify that the route should allow concurrent requests from the same session.
int|null
waitsFor()
Get the maximum number of seconds to wait while attempting to acquire a session lock.