class RouteBlueprint (View source)

Provide a fluent interface for registering routes with the router.

Methods

__construct(Router $router, ViewService $view_service)

Constructor.

array
getAttributes()

Get attributes.

void
setAttributes(array $attributes)

Set the attributes.

attributes(array $attributes)

Fluent alias for setAttributes().

mixed
getAttribute(string $key, mixed $default = '')

Get attribute.

void
setAttribute(string $key, mixed $value)

Set attribute.

attribute(string $key, mixed $value)

Set attribute.

methods(array $methods)

Match requests using one of the specified methods.

url(string $url, array $where = [])

Set the condition attribute to a URL.

where($condition)

Set the condition attribute.

middleware(string|array $middleware)

Set the middleware attribute.

setNamespace(string $namespace)

Set the namespace attribute.

query(callable $query)

Set the query attribute.

void
group(Closure|string $routes)

Create a route group.

handle(string|Closure $handler = '')

Create a route.

view(string|array $views)

Handle a request by directly rendering a view.

all(string|Closure $handler = '')

Match ALL requests.

get()

Match requests with a method of GET or HEAD.

post()

Match requests with a method of POST.

put()

Match requests with a method of PUT.

patch()

Match requests with a method of PATCH.

delete()

Match requests with a method of DELETE.

options()

Match requests with a method of OPTIONS.

any()

Match requests with any method.

Details

__construct(Router $router, ViewService $view_service)

Constructor.

Parameters

Router $router
ViewService $view_service

array getAttributes()

Get attributes.

Return Value

array mixed>

void setAttributes(array $attributes)

Set the attributes.

Parameters

array $attributes mixed> $attributes

Return Value

void

RouteBlueprint attributes(array $attributes)

Fluent alias for setAttributes().

Parameters

array $attributes mixed> $attributes

Return Value

RouteBlueprint $this

mixed getAttribute(string $key, mixed $default = '')

Get attribute.

Parameters

string $key
mixed $default

Return Value

mixed

void setAttribute(string $key, mixed $value)

Set attribute.

Parameters

string $key
mixed $value

Return Value

void

RouteBlueprint attribute(string $key, mixed $value)

Set attribute.

Parameters

string $key
mixed $value

Return Value

RouteBlueprint $this

RouteBlueprint methods(array $methods)

Match requests using one of the specified methods.

Parameters

array $methods

Return Value

RouteBlueprint $this

RouteBlueprint url(string $url, array $where = [])

Set the condition attribute to a URL.

Parameters

string $url
array $where string> $where

Return Value

RouteBlueprint $this

RouteBlueprint where($condition)

Set the condition attribute.

Parameters

$condition

Return Value

RouteBlueprint $this

RouteBlueprint middleware(string|array $middleware)

Set the middleware attribute.

Parameters

string|array $middleware

Return Value

RouteBlueprint $this

RouteBlueprint setNamespace(string $namespace)

Set the namespace attribute.

This should be renamed to namespace for consistency once minimum PHP version is increased to 7+.

Parameters

string $namespace

Return Value

RouteBlueprint $this

RouteBlueprint query(callable $query)

Set the query attribute.

Parameters

callable $query

Return Value

RouteBlueprint $this

void group(Closure|string $routes)

Create a route group.

Parameters

Closure|string $routes Closure or path to file.

Return Value

void

RouteInterface handle(string|Closure $handler = '')

Create a route.

Parameters

string|Closure $handler

Return Value

RouteInterface

RouteInterface view(string|array $views)

Handle a request by directly rendering a view.

Parameters

string|array $views

Return Value

RouteInterface

RouteInterface all(string|Closure $handler = '')

Match ALL requests.

Parameters

string|Closure $handler

Return Value

RouteInterface

RouteBlueprint get()

Match requests with a method of GET or HEAD.

Return Value

RouteBlueprint $this

RouteBlueprint post()

Match requests with a method of POST.

Return Value

RouteBlueprint $this

RouteBlueprint put()

Match requests with a method of PUT.

Return Value

RouteBlueprint $this

RouteBlueprint patch()

Match requests with a method of PATCH.

Return Value

RouteBlueprint $this

RouteBlueprint delete()

Match requests with a method of DELETE.

Return Value

RouteBlueprint $this

RouteBlueprint options()

Match requests with a method of OPTIONS.

Return Value

RouteBlueprint $this

RouteBlueprint any()

Match requests with any method.

Return Value

RouteBlueprint $this