Route
class Route
Route.
Properties
protected array | $methods | Methods. | |
protected string | $route | Route. | |
protected string|Closure | $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 112
__construct(array $methods, string $route, string|Closure $action, string|null $name = null)
Constructor.
at line 130
array
getMethods()
Returns the HTTP methods the route responds to.
at line 140
string
getRoute()
Returns the route.
at line 150
string|Closure
getAction()
Returns the route action.
at line 165
string|null
getName()
Returns the route name.
at line 175
array
getMiddleware()
Returns the middleware.
at line 185
array
getConstraints()
Returns the constraints.
at line 195
setParameters(array $parameters)
Sets the route parameters.
at line 205
array
getParameters()
Returns all the route parameters.
at line 217
mixed
getParameter(string $name, mixed $default = null)
Returns the named parameter value.
at line 228
Route
namespace(string $namespace)
Sets the route action namespace.
at line 241
Route
prefix(string $prefix)
Adds a prefix to the route.
at line 257
Route
patterns(array $patterns)
Sets the custom patterns.
at line 270
Route
middleware(array|string $middleware)
Adds a set of middleware.
at line 283
Route
constraint(array|string $constraint)
Adds a set of constraints.
at line 296
bool
allowsMethod(string $method)
Returns TRUE if the route allows the specified method or FALSE if not.
at line 306
bool
hasTrailingSlash()
Returns TRUE if the route has a trailing slash and FALSE if not.
at line 316
string
getRegex()
Returns the regex needed to match the route.