Route
class Route
Route.
Properties
protected array | $methods | Methods. | |
protected string | $route | Route. | |
protected Closure|string | $action | Route action. | |
protected string | $name | Route name. | |
protected string | $namespace | Route action namespace. | |
protected string | $prefix | Route prefix. | |
protected bool | $hasTrailingSlash | Does the route have a trailing slash? | |
protected array | $patterns | Route patterns. | |
protected array | $middleware | Middleware. | |
protected array | $constraints | Constraints. | |
protected array | $parameters | Parameters. |
Methods
Constructor.
Returns the HTTP methods the route responds to.
Returns the route.
Returns the route name.
Returns the middleware.
Returns the constraints.
Sets the route parameters.
Returns all the route parameters.
Returns the named parameter value.
Adds a set of middleware.
Adds a set of constraints.
Returns TRUE if the route allows the specified method or FALSE if not.
Returns TRUE if the route has a trailing slash and FALSE if not.
Returns the regex needed to match the route.
Details
at line 110
__construct(array $methods, string $route, Closure|string $action, string|null $name = null)
Constructor.
at line 128
array
getMethods()
Returns the HTTP methods the route responds to.
at line 138
string
getRoute()
Returns the route.
at line 148
Closure|string
getAction()
Returns the route action.
at line 163
string|null
getName()
Returns the route name.
at line 173
array
getMiddleware()
Returns the middleware.
at line 183
array
getConstraints()
Returns the constraints.
at line 193
setParameters(array $parameters)
Sets the route parameters.
at line 203
array
getParameters()
Returns all the route parameters.
at line 215
mixed
getParameter(string $name, mixed $default = null)
Returns the named parameter value.
at line 226
Route
namespace(string $namespace)
Sets the route action namespace.
at line 239
Route
prefix(string $prefix)
Adds a prefix to the route.
at line 255
Route
patterns(array $patterns)
Sets the custom patterns.
at line 268
Route
middleware(array|string $middleware)
Adds a set of middleware.
at line 281
Route
constraint(array|string $constraint)
Adds a set of constraints.
at line 294
bool
allowsMethod(string $method)
Returns TRUE if the route allows the specified method or FALSE if not.
at line 304
bool
hasTrailingSlash()
Returns TRUE if the route has a trailing slash and FALSE if not.
at line 314
string
getRegex()
Returns the regex needed to match the route.