class Illuminate / Routing / Route
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

Route

Uses

Properties

public

$uri string

The URI pattern the route responds to.

Default: null
public

$methods array

The HTTP methods the route responds to.

Default: null
public

$action array

The route action array.

Default: null
public

$isFallback bool

Indicates whether the route is a fallback route.

Default: false
public

$controller mixed

The controller instance.

Default: null
public

$defaults array

The default values for the route.

Default: []
public

$wheres array

The regular expression requirements.

Default: []
public

$parameters array|null

The array of matched parameters.

Default: null
public

$parameterNames array|null

The parameter names for the route.

Default: null
protected

$originalParameters array

The array of the matched parameters' original values.

Default: null
protected

$withTrashedBindings bool

Indicates "trashed" models can be retrieved when resolving implicit model bindings for this route.

Default: false
protected

$lockSeconds int|null

Indicates the maximum number of seconds the route should acquire a session lock for.

Default: null
protected

$waitSeconds int|null

Indicates the maximum number of seconds the route should wait while attempting to acquire a session lock.

Default: null
public

$computedMiddleware array|null

The computed gathered middleware.

Default: null
public

$compiled Symfony\...\CompiledRoute

The compiled version of the route.

Default: null
protected

$router Router

The router instance used by the route.

Default: null
protected

$container Container

The container instance used by the route.

Default: null
protected

$bindingFields array

The fields that implicit binding should use for a given parameter.

Default: []
public static

$validators array

The validators used by the routes.

Default: null

Methods

public

__construct ( $methods , $uri , $action ) : void

Create a new Route instance.

Parameters

  • $methods array|string
  • $uri string
  • $action Closure |array
protected

parseAction ( $action ) : array

Parse the route action into a standard array.

Parameters

  • $action callable|array|null
public

run ( ) : mixed

Run the route action and return the response.

protected

isControllerAction ( ) : bool

Checks whether the route's action is a controller.

protected

runCallable ( ) : mixed

Run the route action and return the response.

protected

isSerializedClosure ( ) : bool

Determine if the route action is a serialized Closure.

protected

runController ( ) : mixed

Run the route action and return the response.

public

getController ( ) : mixed

Get the controller instance for the route.

public

getControllerClass ( ) : string|null

Get the controller class used for the route.

protected

getControllerMethod ( ) : string

Get the controller method used for the route.

protected

parseControllerCallback ( ) : array

Parse the controller.

public

flushController ( ) : void

Flush the cached container instance on the route.

public

matches ( Request $request , $includingMethod ) : bool

Determine if the route matches a given request.

Parameters

  • $request Request
  • $includingMethod bool
protected

compileRoute ( ) : Symfony\...\CompiledRoute

Compile the route into a Symfony CompiledRoute instance.

public

bind ( Request $request ) : $this

Bind the route to a given request for execution.

Parameters

public

hasParameters ( ) : bool

Determine if the route has parameters.

public

hasParameter ( $name ) : bool

Determine a given parameter exists from the route.

Parameters

  • $name string
public

parameter ( $name , $default ) : string|object|null

Get a given parameter from the route.

Parameters

  • $name string
  • $default string|object|null
public

originalParameter ( $name , $default ) : string|null

Get original value of a given parameter from the route.

Parameters

  • $name string
  • $default string|null
public

setParameter ( $name , $value ) : void

Set a parameter to the given value.

Parameters

  • $name string
  • $value string|object|null
public

forgetParameter ( $name ) : void

Unset a parameter on the route if it is set.

Parameters

  • $name string
public

parameters ( ) : array

Get the key / value list of parameters for the route.

public

originalParameters ( ) : array

Get the key / value list of original parameters for the route.

public

parametersWithoutNulls ( ) : array

Get the key / value list of parameters without null values.

public

parameterNames ( ) : array

Get all of the parameter names for the route.

protected

compileParameterNames ( ) : array

Get the parameter names for the route.

public

signatureParameters ( $conditions ) : array

Get the parameters that are listed in the route / controller signature.

Parameters

  • $conditions array
public

bindingFieldFor ( $parameter ) : string|null

Get the binding field for the given parameter.

Parameters

  • $parameter string|int
public

bindingFields ( ) : array

Get the binding fields for the route.

public

setBindingFields ( array $bindingFields ) : $this

Set the binding fields for the route.

Parameters

  • $bindingFields array
public

parentOfParameter ( $parameter ) : string

Get the parent parameter of the given parameter.

Parameters

  • $parameter string
public

withTrashed ( $withTrashed ) : $this

Allow "trashed" models to be retrieved when resolving implicit model bindings for this route.

Parameters

  • $withTrashed bool
public

allowsTrashedBindings ( ) : bool

Determines if the route allows "trashed" models to be retrieved when resolving implicit model bindings.

public

defaults ( $key , $value ) : $this

Set a default value for the route.

Parameters

  • $key string
  • $value mixed
public

setDefaults ( array $defaults ) : $this

Set the default values for the route.

Parameters

  • $defaults array
public

where ( $name , $expression ) : $this

Set a regular expression requirement on the route.

Parameters

  • $name array|string
  • $expression string|null
protected

parseWhere ( $name , $expression ) : array

Parse arguments to the where method into an array.

Parameters

  • $name array|string
  • $expression string
public

setWheres ( array $wheres ) : $this

Set a list of regular expression requirements on the route.

Parameters

  • $wheres array
public

fallback ( ) : $this

Mark this route as a fallback route.

public

setFallback ( $isFallback ) : $this

Set the fallback value.

Parameters

  • $isFallback bool
public

methods ( ) : array

Get the HTTP verbs the route responds to.

public

httpOnly ( ) : bool

Determine if the route only responds to HTTP requests.

public

httpsOnly ( ) : bool

Determine if the route only responds to HTTPS requests.

public

secure ( ) : bool

Determine if the route only responds to HTTPS requests.

public

domain ( $domain ) : $this|string|null

Get or set the domain for the route.

Parameters

  • $domain string|null
public

getDomain ( ) : string|null

Get the domain defined for the route.

public

getPrefix ( ) : string|null

Get the prefix of the route instance.

public

prefix ( $prefix ) : $this

Add a prefix to the route URI.

Parameters

  • $prefix string
protected

updatePrefixOnAction ( $prefix ) : void

Update the "prefix" attribute on the action array.

Parameters

  • $prefix string
public

uri ( ) : string

Get the URI associated with the route.

public

setUri ( $uri ) : $this

Set the URI that the route responds to.

Parameters

  • $uri string
protected

parseUri ( $uri ) : string

Parse the route URI and normalize / store any implicit binding fields.

Parameters

  • $uri string
public

getName ( ) : string|null

Get the name of the route instance.

public

name ( $name ) : $this

Add or change the route name.

Parameters

  • $name string
public

named ( $patterns ) : bool

Determine whether the route's name matches the given patterns.

Parameters

  • $patterns mixed
public

uses ( $action ) : $this

Set the handler for the route.

Parameters

protected

addGroupNamespaceToStringUses ( $action ) : string

Parse a string based action for the "uses" fluent method.

Parameters

  • $action string
public

getActionName ( ) : string

Get the action name for the route.

public

getActionMethod ( ) : string

Get the method name of the route action.

public

getAction ( $key ) : mixed

Get the action array or one of its properties for the route.

Parameters

  • $key string|null
public

setAction ( array $action ) : $this

Set the action array for the route.

Parameters

  • $action array
public

getMissing ( ) : Closure |null

Get the value of the action that should be taken on a missing model exception.

public

missing ( $missing ) : $this

Define the callable that should be invoked on a missing model exception.

Parameters

public

gatherMiddleware ( ) : array

Get all middleware, including the ones from the controller.

public

middleware ( $middleware ) : $this|array

Get or set the middlewares attached to the route.

Parameters

  • $middleware array|string|null
public

can ( $ability , $models ) : $this

Specify that the "Authorize" / "can" middleware should be applied to the route with the given options.

Parameters

  • $ability string
  • $models array|string
public

controllerMiddleware ( ) : array

Get the middleware for the route's controller.

protected

staticallyProvidedControllerMiddleware ( string $class , string $method ) : array

Get the statically provided controller middleware for the given class and method.

Parameters

  • $class string
  • $method string
public

withoutMiddleware ( $middleware ) : $this

Specify middleware that should be removed from the given route.

Parameters

  • $middleware array|string
public

excludedMiddleware ( ) : array

Get the middleware should be removed from the route.

public

scopeBindings ( ) : $this

Indicate that the route should enforce scoping of multiple implicit Eloquent bindings.

public

withoutScopedBindings ( ) : $this

Indicate that the route should not enforce scoping of multiple implicit Eloquent bindings.

public

enforcesScopedBindings ( ) : bool

Determine if the route should enforce scoping of multiple implicit Eloquent bindings.

public

preventsScopedBindings ( ) : bool

Determine if the route should prevent scoping of multiple implicit Eloquent bindings.

public

block ( $lockSeconds , $waitSeconds ) : $this

Specify that the route should not allow concurrent requests from the same session.

Parameters

  • $lockSeconds int|null
  • $waitSeconds int|null
public

withoutBlocking ( ) : $this

Specify that the route should allow concurrent requests from the same session.

public

locksFor ( ) : int|null

Get the maximum number of seconds the route's session lock should be held for.

public

waitsFor ( ) : int|null

Get the maximum number of seconds to wait while attempting to acquire a session lock.

public

controllerDispatcher ( ) : ControllerDispatcher

Get the dispatcher for the route's controller.

public static

getValidators ( ) : array

Get the route validators for the instance.

public

toSymfonyRoute ( ) : Symfony\...\Route

Convert the route to a Symfony route.

protected

getOptionalParameterNames ( ) : array

Get the optional parameter names for the route.

public

getCompiled ( ) : Symfony\...\CompiledRoute

Get the compiled version of the route.

public

setRouter ( Router $router ) : $this

Set the router instance on the route.

Parameters

public

setContainer ( Container $container ) : $this

Set the container instance on the route.

Parameters

public

prepareForSerialization ( ) : void

Prepare the route instance for serialization.

public

__get ( $key ) : mixed

Dynamically access route parameters.

Parameters

  • $key string