class Router implements Registrar, BindingRegistrar (View source)
Macroable |
array | $middlewarePriority | The priority-sorted list of middleware. | |
static array | $verbs | All of the verbs supported by the router. |
static void | macro(string $name, callable $macro) Register a custom macro. | from Macroable |
static bool | hasMacro(string $name) Checks if macro is registered. | from Macroable |
static mixed | __callStatic(string $method, array $parameters) Dynamically handle calls to the class. | from Macroable |
mixed | __call(string $method, array $parameters) Dynamically handle calls into the router instance. | |
void | __construct(Dispatcher $events, Container $container = null) Create a new Router instance. | |
void | get(string $uri, Closure|array|string $action = null) Register a new GET route with the router. | |
void | post(string $uri, Closure|array|string $action = null) Register a new POST route with the router. | |
void | put(string $uri, Closure|array|string $action = null) Register a new PUT route with the router. | |
void | patch(string $uri, Closure|array|string $action = null) Register a new PATCH route with the router. | |
void | delete(string $uri, Closure|array|string $action = null) Register a new DELETE route with the router. | |
void | options(string $uri, Closure|array|string $action = null) Register a new OPTIONS route with the router. | |
Route | any(string $uri, Closure|array|string|null $action = null) Register a new route responding to all verbs. | |
void | match(array|string $methods, string $uri, Closure|array|string $action = null) Register a new route with the given verbs. | |
void | resources(array $resources) Register an array of resource controllers. | |
void | resource(string $name, string $controller, array $options = array()) Route a resource to a controller. | |
void | group(array $attributes, Closure|string $routes) Create a route group with shared attributes. | |
array | mergeWithLastGroup(array $new) Merge the given array with the last group stack. | |
string | getLastGroupPrefix() Get the prefix from the last group on the stack. | |
Response | dispatch(Request $request) Dispatch the request to the application. | |
mixed | dispatchToRoute(Request $request) Dispatch the request to a route and return the response. | |
array | gatherRouteMiddleware(Route $route) Gather the middleware for the given route with resolved class names. | |
Response | prepareResponse(Request $request, mixed $response) Create a response instance from the given value. | |
Route | substituteBindings(Route $route) Substitute the route bindings onto the route. | |
void | substituteImplicitBindings(Route $route) Substitute the implicit Eloquent model bindings for the route. | |
void | matched(string|callable $callback) Register a route matched event listener. | |
array | getMiddleware() Get all of the defined middleware short-hand names. | |
$this | aliasMiddleware(string $name, string $class) Register a short-hand name for a middleware. | |
bool | hasMiddlewareGroup(string $name) Check if a middlewareGroup with the given name exists. | |
array | getMiddlewareGroups() Get all of the defined middleware groups. | |
$this | middlewareGroup(string $name, array $middleware) Register a group of middleware. | |
$this | prependMiddlewareToGroup(string $group, string $middleware) Add a middleware to the beginning of a middleware group. | |
$this | pushMiddlewareToGroup(string $group, string $middleware) Add a middleware to the end of a middleware group. | |
void | bind(string $key, string|callable $binder) Add a new route parameter binder. | |
void | model(string $key, string $class, Closure $callback = null) Register a model binder for a wildcard. | |
Closure | getBindingCallback(string $key) Get the binding callback for a given binding. | |
array | getPatterns() Get the global "where" patterns. | |
void | pattern(string $key, string $pattern) Set a global where pattern on all routes. | |
void | patterns(array $patterns) Set a group of global where patterns on all routes. | |
bool | hasGroupStack() Determine if the router currently has a group stack. | |
array | getGroupStack() Get the current group stack for the router. | |
mixed | input(string $key, string $default = null) Get a route parameter for the current route. | |
Request | getCurrentRequest() Get the request currently being dispatched. | |
Route | getCurrentRoute() Get the currently dispatched route instance. | |
Route | current() Get the currently dispatched route instance. | |
bool | has(string $name) Check if a route with the given name exists. | |
string|null | currentRouteName() Get the current route name. | |
bool | is() Alias for the "currentRouteNamed" method. | |
bool | currentRouteNamed(string $name) Determine if the current route matches a given name. | |
string|null | currentRouteAction() Get the current route action. | |
bool | uses() Alias for the "currentRouteUses" method. | |
bool | currentRouteUses(string $action) Determine if the current route action matches a given action. | |
void | auth() Register the typical authentication routes for an application. | |
void | singularResourceParameters(bool $singular = true) Set the unmapped global resource parameters to singular. | |
void | resourceParameters(array $parameters = array()) Set the global resource parameter mapping. | |
array|null | resourceVerbs(array $verbs = array()) Get or set the verbs used in the resource URIs. | |
RouteCollection | getRoutes() Get the underlying route collection. | |
void | setRoutes(RouteCollection $routes) Set the route collection instance. |
Register a custom macro.
Checks if macro is registered.
Dynamically handle calls to the class.
Dynamically handle calls into the router instance.
Create a new Router instance.
Register a new GET route with the router.
Register a new POST route with the router.
Register a new PUT route with the router.
Register a new PATCH route with the router.
Register a new DELETE route with the router.
Register a new OPTIONS route with the router.
Register a new route responding to all verbs.
Register a new route with the given verbs.
Register an array of resource controllers.
Route a resource to a controller.
Create a route group with shared attributes.
Merge the given array with the last group stack.
Get the prefix from the last group on the stack.
Dispatch the request to a route and return the response.
Gather the middleware for the given route with resolved class names.
Create a response instance from the given value.
Substitute the implicit Eloquent model bindings for the route.
Register a route matched event listener.
Get all of the defined middleware short-hand names.
Register a short-hand name for a middleware.
Check if a middlewareGroup with the given name exists.
Get all of the defined middleware groups.
Register a group of middleware.
Add a middleware to the beginning of a middleware group.
If the middleware is already in the group, it will not be added again.
Add a middleware to the end of a middleware group.
If the middleware is already in the group, it will not be added again.
Add a new route parameter binder.
Register a model binder for a wildcard.
Get the binding callback for a given binding.
Get the global "where" patterns.
Set a global where pattern on all routes.
Set a group of global where patterns on all routes.
Determine if the router currently has a group stack.
Get the current group stack for the router.
Get a route parameter for the current route.
Get the request currently being dispatched.
Get the currently dispatched route instance.
Get the currently dispatched route instance.
Check if a route with the given name exists.
Get the current route name.
Alias for the "currentRouteNamed" method.
Determine if the current route matches a given name.
Get the current route action.
Alias for the "currentRouteUses" method.
Determine if the current route action matches a given action.
Register the typical authentication routes for an application.
Set the unmapped global resource parameters to singular.
Set the global resource parameter mapping.
Get or set the verbs used in the resource URIs.
Get the underlying route collection.
Set the route collection instance.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.4/Illuminate/Routing/Router.html