class RouteRegistrar (View source)

Traits

Properties

protected Router $router

The router instance.

protected array $attributes

The attributes to pass on to the router.

protected string[] $passthru

The methods to dynamically pass through to the router.

protected string[] $allowedAttributes

The attributes that can be set through this class.

protected array $aliases

The attributes that are aliased.

Methods

$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
whereUlid(array|string $parameters)

Specify that the given route parameters must be ULIDs.

$this
whereUuid(array|string $parameters)

Specify that the given route parameters must be UUIDs.

$this
whereIn(array|string $parameters, array $values)

Specify that the given route parameters must be one of the given values.

$this
assignExpressionToParameters(array|string $parameters, string $expression)

Apply the given regular expression to the given parameters.

void
__construct(Router $router)

Create a new route registrar instance.

$this
attribute(string $key, mixed $value)

Set the value for a given attribute.

resource(string $name, string $controller, array $options = [])

Route a resource to a controller.

apiResource(string $name, string $controller, array $options = [])

Route an API resource to a controller.

singleton(string $name, string $controller, array $options = [])

Route a singleton resource to a controller.

apiSingleton(string $name, string $controller, array $options = [])

Route an API singleton resource to a controller.

$this
group(Closure|array|string $callback)

Create a route group with shared attributes.

match(array|string $methods, string $uri, Closure|array|string|null $action = null)

Register a new route with the given verbs.

registerRoute(string $method, string $uri, Closure|array|string|null $action = null)

Register a new route with the router.

array
compileAction(Closure|array|string|null $action)

Compile the action into an array including the attributes.

Route|$this
__call(string $method, array $parameters)

Dynamically handle calls into the route registrar.

any(string $uri, Closure|array|string|null $action = null)

No description

delete(string $uri, Closure|array|string|null $action = null)

No description

get(string $uri, Closure|array|string|null $action = null)

No description

options(string $uri, Closure|array|string|null $action = null)

No description

patch(string $uri, Closure|array|string|null $action = null)

No description

post(string $uri, Closure|array|string|null $action = null)

No description

put(string $uri, Closure|array|string|null $action = null)

No description

as(string $value)

No description

controller(string $controller)

No description

domain(string $value)

No description

middleware(array|string|null $middleware)

No description

name(string $value)

No description

namespace(string|null $value)

No description

prefix(string $prefix)

No description

scopeBindings()

No description

where(array $where)

No description

withoutMiddleware(array|string $middleware)

No description

Details

$this whereAlpha(array|string $parameters)

Specify that the given route parameters must be alphabetic.

Parameters

array|string $parameters

Return Value

$this

$this whereAlphaNumeric(array|string $parameters)

Specify that the given route parameters must be alphanumeric.

Parameters

array|string $parameters

Return Value

$this

$this whereNumber(array|string $parameters)

Specify that the given route parameters must be numeric.

Parameters

array|string $parameters

Return Value

$this

$this whereUlid(array|string $parameters)

Specify that the given route parameters must be ULIDs.

Parameters

array|string $parameters

Return Value

$this

$this whereUuid(array|string $parameters)

Specify that the given route parameters must be UUIDs.

Parameters

array|string $parameters

Return Value

$this

$this whereIn(array|string $parameters, array $values)

Specify that the given route parameters must be one of the given values.

Parameters

array|string $parameters
array $values

Return Value

$this

protected $this assignExpressionToParameters(array|string $parameters, string $expression)

Apply the given regular expression to the given parameters.

Parameters

array|string $parameters
string $expression

Return Value

$this

void __construct(Router $router)

Create a new route registrar instance.

Parameters

Router $router

Return Value

void

$this attribute(string $key, mixed $value)

Set the value for a given attribute.

Parameters

string $key
mixed $value

Return Value

$this

Exceptions

InvalidArgumentException

PendingResourceRegistration resource(string $name, string $controller, array $options = [])

Route a resource to a controller.

Parameters

string $name
string $controller
array $options

Return Value

PendingResourceRegistration

PendingResourceRegistration apiResource(string $name, string $controller, array $options = [])

Route an API resource to a controller.

Parameters

string $name
string $controller
array $options

Return Value

PendingResourceRegistration

PendingSingletonResourceRegistration singleton(string $name, string $controller, array $options = [])

Route a singleton resource to a controller.

Parameters

string $name
string $controller
array $options

Return Value

PendingSingletonResourceRegistration

PendingSingletonResourceRegistration apiSingleton(string $name, string $controller, array $options = [])

Route an API singleton resource to a controller.

Parameters

string $name
string $controller
array $options

Return Value

PendingSingletonResourceRegistration

$this group(Closure|array|string $callback)

Create a route group with shared attributes.

Parameters

Closure|array|string $callback

Return Value

$this

Route match(array|string $methods, string $uri, Closure|array|string|null $action = null)

Register a new route with the given verbs.

Parameters

array|string $methods
string $uri
Closure|array|string|null $action

Return Value

Route

protected Route registerRoute(string $method, string $uri, Closure|array|string|null $action = null)

Register a new route with the router.

Parameters

string $method
string $uri
Closure|array|string|null $action

Return Value

Route

protected array compileAction(Closure|array|string|null $action)

Compile the action into an array including the attributes.

Parameters

Closure|array|string|null $action

Return Value

array

Route|$this __call(string $method, array $parameters)

Dynamically handle calls into the route registrar.

Parameters

string $method
array $parameters

Return Value

Route|$this

Exceptions

BadMethodCallException

Route any(string $uri, Closure|array|string|null $action = null)

No description

Parameters

string $uri
Closure|array|string|null $action

Return Value

Route

Route delete(string $uri, Closure|array|string|null $action = null)

No description

Parameters

string $uri
Closure|array|string|null $action

Return Value

Route

Route get(string $uri, Closure|array|string|null $action = null)

No description

Parameters

string $uri
Closure|array|string|null $action

Return Value

Route

Route options(string $uri, Closure|array|string|null $action = null)

No description

Parameters

string $uri
Closure|array|string|null $action

Return Value

Route

Route patch(string $uri, Closure|array|string|null $action = null)

No description

Parameters

string $uri
Closure|array|string|null $action

Return Value

Route

Route post(string $uri, Closure|array|string|null $action = null)

No description

Parameters

string $uri
Closure|array|string|null $action

Return Value

Route

Route put(string $uri, Closure|array|string|null $action = null)

No description

Parameters

string $uri
Closure|array|string|null $action

Return Value

Route

RouteRegistrar as(string $value)

No description

Parameters

string $value

Return Value

RouteRegistrar

RouteRegistrar controller(string $controller)

No description

Parameters

string $controller

Return Value

RouteRegistrar

RouteRegistrar domain(string $value)

No description

Parameters

string $value

Return Value

RouteRegistrar

RouteRegistrar middleware(array|string|null $middleware)

No description

Parameters

array|string|null $middleware

Return Value

RouteRegistrar

RouteRegistrar name(string $value)

No description

Parameters

string $value

Return Value

RouteRegistrar

RouteRegistrar namespace(string|null $value)

No description

Parameters

string|null $value

Return Value

RouteRegistrar

RouteRegistrar prefix(string $prefix)

No description

Parameters

string $prefix

Return Value

RouteRegistrar

RouteRegistrar scopeBindings()

No description

Return Value

RouteRegistrar

RouteRegistrar where(array $where)

No description

Parameters

array $where

Return Value

RouteRegistrar

RouteRegistrar withoutMiddleware(array|string $middleware)

No description

Parameters

array|string $middleware

Return Value

RouteRegistrar

RouteRegistrar withoutScopedBindings()

No description

Return Value

RouteRegistrar