PHP Класс Illuminate\Routing\Router

Наследование: implements Illuminate\Contracts\Routing\Registrar, use trait Illuminate\Support\Traits\Macroable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$middlewarePriority array Forces the listed middleware to always be in the given order.
$verbs array All of the verbs supported by the router.

Защищенные свойства (Protected)

Свойство Тип Описание
$binders array The registered route value binders.
$container Illuminate\Container\Container The IoC container instance.
$current Illuminate\Routing\Route The currently dispatched route instance.
$currentRequest Illuminate\Http\Request The request currently being dispatched.
$events Illuminate\Contracts\Events\Dispatcher The event dispatcher instance.
$groupStack array The route group attribute stack.
$middleware array All of the short-hand keys for middlewares.
$middlewareGroups array All of the middleware groups.
$patterns array The globally available parameter patterns.
$routes Illuminate\Routing\RouteCollection The route collection instance.

Открытые методы

Метод Описание
__construct ( Illuminate\Contracts\Events\Dispatcher $events, Illuminate\Container\Container $container = null ) : void Create a new Router instance.
any ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route Register a new route responding to all verbs.
auth ( ) : void Register the typical authentication routes for an application.
bind ( string $key, string | callable $binder ) : void Add a new route parameter binder.
createClassBinding ( string $binding ) : Closure Create a class based binding using the IoC container.
current ( ) : Illuminate\Routing\Route Get the currently dispatched route instance.
currentRouteAction ( ) : string | null Get the current route action.
currentRouteName ( ) : string | null Get the current route name.
currentRouteNamed ( string $name ) : boolean Determine if the current route matches a given name.
currentRouteUses ( string $action ) : boolean Determine if the current route action matches a given action.
delete ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route Register a new DELETE route with the router.
dispatch ( Illuminate\Http\Request $request ) : Illuminate\Http\Response Dispatch the request to the application.
dispatchToRoute ( Illuminate\Http\Request $request ) : mixed Dispatch the request to a route and return the response.
gatherRouteMiddleware ( Illuminate\Routing\Route $route ) : array Gather the middleware for the given route.
get ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route Register a new GET route with the router.
getBindingCallback ( string $key ) : Closure | null Get the binding callback for a given binding.
getCurrentRequest ( ) : Illuminate\Http\Request Get the request currently being dispatched.
getCurrentRoute ( ) : Illuminate\Routing\Route Get the currently dispatched route instance.
getGroupStack ( ) : array Get the current group stack for the router.
getLastGroupPrefix ( ) : string Get the prefix from the last group on the stack.
getMiddleware ( ) : array Get all of the defined middleware short-hand names.
getPatterns ( ) : array Get the global "where" patterns.
getRoutes ( ) : Illuminate\Routing\RouteCollection Get the underlying route collection.
group ( array $attributes, Closure $callback ) : void Create a route group with shared attributes.
has ( string $name ) : boolean Check if a route with the given name exists.
hasGroupStack ( ) : boolean Determine if the router currently has a group stack.
input ( string $key, string $default = null ) : mixed Get a route parameter for the current route.
is ( ) : boolean Alias for the "currentRouteNamed" method.
match ( array | string $methods, string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route Register a new route with the given verbs.
matched ( string | callable $callback ) : void Register a route matched event listener.
mergeGroup ( array $new, array $old ) : array Merge the given group attributes.
mergeWithLastGroup ( array $new ) : array Merge the given array with the last group stack.
middleware ( string $name, string $class ) Register a short-hand name for a middleware.
middlewareGroup ( string $name, array $middleware ) Register a group of middleware.
model ( string $key, string $class, Closure $callback = null ) : void Register a model binder for a wildcard.
options ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route Register a new OPTIONS route with the router.
patch ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route Register a new PATCH route with the router.
pattern ( string $key, string $pattern ) : void Set a global where pattern on all routes.
patterns ( array $patterns ) : void Set a group of global where patterns on all routes.
post ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route Register a new POST route with the router.
prepareResponse ( Request $request, mixed $response ) : Illuminate\Http\Response Create a response instance from the given value.
prependMiddlewareToGroup ( string $group, string $middleware ) Add a middleware to the beginning of a middleware group.
pushMiddlewareToGroup ( string $group, string $middleware ) Add a middleware to the end of a middleware group.
put ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route Register a new PUT route with the router.
resolveMiddlewareClassName ( string $name ) : string | array Resolve the middleware name to a class name(s) preserving passed parameters.
resource ( string $name, string $controller, array $options = [] ) : void Route a resource to a controller.
resourceParameters ( array $parameters = [] ) : void Set the global resource parameter mapping.
resources ( array $resources ) : void Register an array of resource controllers.
setRoutes ( Illuminate\Routing\RouteCollection $routes ) : void Set the route collection instance.
singularResourceParameters ( boolean $singular = true ) : void Set the unmapped global resource parameters to singular.
substituteBindings ( Illuminate\Routing\Route $route ) : Illuminate\Routing\Route Substitute the route bindings onto the route.
substituteImplicitBindings ( Illuminate\Routing\Route $route ) : void Substitute the implicit Eloquent model bindings for the route.
uses ( ) : boolean Alias for the "currentRouteUses" method.

Защищенные методы

Метод Описание
actionReferencesController ( array $action ) : boolean Determine if the action is routing to a controller.
addRoute ( array | string $methods, string $uri, Closure | array | string | null $action ) : Illuminate\Routing\Route Add a route to the underlying route collection.
addWhereClausesToRoute ( Illuminate\Routing\Route $route ) : Illuminate\Routing\Route Add the necessary where clauses to the route based on its initial registration.
convertToControllerAction ( array | string $action ) : array Add a controller based route action to the action array.
createRoute ( array | string $methods, string $uri, mixed $action ) : Illuminate\Routing\Route Create a new route instance.
findRoute ( Illuminate\Http\Request $request ) : Illuminate\Routing\Route Find the route matching a given request.
formatGroupPrefix ( array $new, array $old ) : string | null Format the prefix for the new group attributes.
formatUsesPrefix ( array $new, array $old ) : string | null Format the uses prefix for the new group attributes.
mergeGroupAttributesIntoRoute ( Illuminate\Routing\Route $route ) : void Merge the group stack with the controller action.
newRoute ( array | string $methods, string $uri, mixed $action ) : Illuminate\Routing\Route Create a new Route object.
parseMiddlewareGroup ( string $name ) : array Parse the middleware group and format it for usage.
performBinding ( string $key, string $value, Illuminate\Routing\Route $route ) : mixed Call the binding callback for the given key.
prefix ( string $uri ) : string Prefix the given URI with the last prefix.
prependGroupUses ( string $uses ) : string Prepend the last group uses onto the use clause.
runRouteWithinStack ( Illuminate\Routing\Route $route, Illuminate\Http\Request $request ) : mixed Run the given route within a Stack "onion" instance.
sortMiddleware ( Collection $middlewares ) : array Sort the given middleware by priority.
updateGroupStack ( array $attributes ) : void Update the group stack with the given attributes.

Описание методов

__construct() публичный Метод

Create a new Router instance.
public __construct ( Illuminate\Contracts\Events\Dispatcher $events, Illuminate\Container\Container $container = null ) : void
$events Illuminate\Contracts\Events\Dispatcher
$container Illuminate\Container\Container
Результат void

actionReferencesController() защищенный Метод

Determine if the action is routing to a controller.
protected actionReferencesController ( array $action ) : boolean
$action array
Результат boolean

addRoute() защищенный Метод

Add a route to the underlying route collection.
protected addRoute ( array | string $methods, string $uri, Closure | array | string | null $action ) : Illuminate\Routing\Route
$methods array | string
$uri string
$action Closure | array | string | null
Результат Illuminate\Routing\Route

addWhereClausesToRoute() защищенный Метод

Add the necessary where clauses to the route based on its initial registration.
protected addWhereClausesToRoute ( Illuminate\Routing\Route $route ) : Illuminate\Routing\Route
$route Illuminate\Routing\Route
Результат Illuminate\Routing\Route

any() публичный Метод

Register a new route responding to all verbs.
public any ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route
$uri string
$action Closure | array | string | null
Результат Illuminate\Routing\Route

auth() публичный Метод

Register the typical authentication routes for an application.
public auth ( ) : void
Результат void

bind() публичный Метод

Add a new route parameter binder.
public bind ( string $key, string | callable $binder ) : void
$key string
$binder string | callable
Результат void

convertToControllerAction() защищенный Метод

Add a controller based route action to the action array.
protected convertToControllerAction ( array | string $action ) : array
$action array | string
Результат array

createClassBinding() публичный Метод

Create a class based binding using the IoC container.
public createClassBinding ( string $binding ) : Closure
$binding string
Результат Closure

createRoute() защищенный Метод

Create a new route instance.
protected createRoute ( array | string $methods, string $uri, mixed $action ) : Illuminate\Routing\Route
$methods array | string
$uri string
$action mixed
Результат Illuminate\Routing\Route

current() публичный Метод

Get the currently dispatched route instance.
public current ( ) : Illuminate\Routing\Route
Результат Illuminate\Routing\Route

currentRouteAction() публичный Метод

Get the current route action.
public currentRouteAction ( ) : string | null
Результат string | null

currentRouteName() публичный Метод

Get the current route name.
public currentRouteName ( ) : string | null
Результат string | null

currentRouteNamed() публичный Метод

Determine if the current route matches a given name.
public currentRouteNamed ( string $name ) : boolean
$name string
Результат boolean

currentRouteUses() публичный Метод

Determine if the current route action matches a given action.
public currentRouteUses ( string $action ) : boolean
$action string
Результат boolean

delete() публичный Метод

Register a new DELETE route with the router.
public delete ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route
$uri string
$action Closure | array | string | null
Результат Illuminate\Routing\Route

dispatch() публичный Метод

Dispatch the request to the application.
public dispatch ( Illuminate\Http\Request $request ) : Illuminate\Http\Response
$request Illuminate\Http\Request
Результат Illuminate\Http\Response

dispatchToRoute() публичный Метод

Dispatch the request to a route and return the response.
public dispatchToRoute ( Illuminate\Http\Request $request ) : mixed
$request Illuminate\Http\Request
Результат mixed

findRoute() защищенный Метод

Find the route matching a given request.
protected findRoute ( Illuminate\Http\Request $request ) : Illuminate\Routing\Route
$request Illuminate\Http\Request
Результат Illuminate\Routing\Route

formatGroupPrefix() защищенный статический Метод

Format the prefix for the new group attributes.
protected static formatGroupPrefix ( array $new, array $old ) : string | null
$new array
$old array
Результат string | null

formatUsesPrefix() защищенный статический Метод

Format the uses prefix for the new group attributes.
protected static formatUsesPrefix ( array $new, array $old ) : string | null
$new array
$old array
Результат string | null

gatherRouteMiddleware() публичный Метод

Gather the middleware for the given route.
public gatherRouteMiddleware ( Illuminate\Routing\Route $route ) : array
$route Illuminate\Routing\Route
Результат array

get() публичный Метод

Register a new GET route with the router.
public get ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route
$uri string
$action Closure | array | string | null
Результат Illuminate\Routing\Route

getBindingCallback() публичный Метод

Get the binding callback for a given binding.
public getBindingCallback ( string $key ) : Closure | null
$key string
Результат Closure | null

getCurrentRequest() публичный Метод

Get the request currently being dispatched.
public getCurrentRequest ( ) : Illuminate\Http\Request
Результат Illuminate\Http\Request

getCurrentRoute() публичный Метод

Get the currently dispatched route instance.
public getCurrentRoute ( ) : Illuminate\Routing\Route
Результат Illuminate\Routing\Route

getGroupStack() публичный Метод

Get the current group stack for the router.
public getGroupStack ( ) : array
Результат array

getLastGroupPrefix() публичный Метод

Get the prefix from the last group on the stack.
public getLastGroupPrefix ( ) : string
Результат string

getMiddleware() публичный Метод

Get all of the defined middleware short-hand names.
public getMiddleware ( ) : array
Результат array

getPatterns() публичный Метод

Get the global "where" patterns.
public getPatterns ( ) : array
Результат array

getRoutes() публичный Метод

Get the underlying route collection.
public getRoutes ( ) : Illuminate\Routing\RouteCollection
Результат Illuminate\Routing\RouteCollection

group() публичный Метод

Create a route group with shared attributes.
public group ( array $attributes, Closure $callback ) : void
$attributes array
$callback Closure
Результат void

has() публичный Метод

Check if a route with the given name exists.
public has ( string $name ) : boolean
$name string
Результат boolean

hasGroupStack() публичный Метод

Determine if the router currently has a group stack.
public hasGroupStack ( ) : boolean
Результат boolean

input() публичный Метод

Get a route parameter for the current route.
public input ( string $key, string $default = null ) : mixed
$key string
$default string
Результат mixed

is() публичный Метод

Alias for the "currentRouteNamed" method.
public is ( ) : boolean
Результат boolean

match() публичный Метод

Register a new route with the given verbs.
public match ( array | string $methods, string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route
$methods array | string
$uri string
$action Closure | array | string | null
Результат Illuminate\Routing\Route

matched() публичный Метод

Register a route matched event listener.
public matched ( string | callable $callback ) : void
$callback string | callable
Результат void

mergeGroup() публичный статический Метод

Merge the given group attributes.
public static mergeGroup ( array $new, array $old ) : array
$new array
$old array
Результат array

mergeGroupAttributesIntoRoute() защищенный Метод

Merge the group stack with the controller action.
protected mergeGroupAttributesIntoRoute ( Illuminate\Routing\Route $route ) : void
$route Illuminate\Routing\Route
Результат void

mergeWithLastGroup() публичный Метод

Merge the given array with the last group stack.
public mergeWithLastGroup ( array $new ) : array
$new array
Результат array

middleware() публичный Метод

Register a short-hand name for a middleware.
public middleware ( string $name, string $class )
$name string
$class string

middlewareGroup() публичный Метод

Register a group of middleware.
public middlewareGroup ( string $name, array $middleware )
$name string
$middleware array

model() публичный Метод

Register a model binder for a wildcard.
public model ( string $key, string $class, Closure $callback = null ) : void
$key string
$class string
$callback Closure
Результат void

newRoute() защищенный Метод

Create a new Route object.
protected newRoute ( array | string $methods, string $uri, mixed $action ) : Illuminate\Routing\Route
$methods array | string
$uri string
$action mixed
Результат Illuminate\Routing\Route

options() публичный Метод

Register a new OPTIONS route with the router.
public options ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route
$uri string
$action Closure | array | string | null
Результат Illuminate\Routing\Route

parseMiddlewareGroup() защищенный Метод

Parse the middleware group and format it for usage.
protected parseMiddlewareGroup ( string $name ) : array
$name string
Результат array

patch() публичный Метод

Register a new PATCH route with the router.
public patch ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route
$uri string
$action Closure | array | string | null
Результат Illuminate\Routing\Route

pattern() публичный Метод

Set a global where pattern on all routes.
public pattern ( string $key, string $pattern ) : void
$key string
$pattern string
Результат void

patterns() публичный Метод

Set a group of global where patterns on all routes.
public patterns ( array $patterns ) : void
$patterns array
Результат void

performBinding() защищенный Метод

Call the binding callback for the given key.
protected performBinding ( string $key, string $value, Illuminate\Routing\Route $route ) : mixed
$key string
$value string
$route Illuminate\Routing\Route
Результат mixed

post() публичный Метод

Register a new POST route with the router.
public post ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route
$uri string
$action Closure | array | string | null
Результат Illuminate\Routing\Route

prefix() защищенный Метод

Prefix the given URI with the last prefix.
protected prefix ( string $uri ) : string
$uri string
Результат string

prepareResponse() публичный Метод

Create a response instance from the given value.
public prepareResponse ( Request $request, mixed $response ) : Illuminate\Http\Response
$request Symfony\Component\HttpFoundation\Request
$response mixed
Результат Illuminate\Http\Response

prependGroupUses() защищенный Метод

Prepend the last group uses onto the use clause.
protected prependGroupUses ( string $uses ) : string
$uses string
Результат string

prependMiddlewareToGroup() публичный Метод

If the middleware is already in the group, it will not be added again.
public prependMiddlewareToGroup ( string $group, string $middleware )
$group string
$middleware string

pushMiddlewareToGroup() публичный Метод

If the middleware is already in the group, it will not be added again.
public pushMiddlewareToGroup ( string $group, string $middleware )
$group string
$middleware string

put() публичный Метод

Register a new PUT route with the router.
public put ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route
$uri string
$action Closure | array | string | null
Результат Illuminate\Routing\Route

resolveMiddlewareClassName() публичный Метод

Resolve the middleware name to a class name(s) preserving passed parameters.
public resolveMiddlewareClassName ( string $name ) : string | array
$name string
Результат string | array

resource() публичный Метод

Route a resource to a controller.
public resource ( string $name, string $controller, array $options = [] ) : void
$name string
$controller string
$options array
Результат void

resourceParameters() публичный Метод

Set the global resource parameter mapping.
public resourceParameters ( array $parameters = [] ) : void
$parameters array
Результат void

resources() публичный Метод

Register an array of resource controllers.
public resources ( array $resources ) : void
$resources array
Результат void

runRouteWithinStack() защищенный Метод

Run the given route within a Stack "onion" instance.
protected runRouteWithinStack ( Illuminate\Routing\Route $route, Illuminate\Http\Request $request ) : mixed
$route Illuminate\Routing\Route
$request Illuminate\Http\Request
Результат mixed

setRoutes() публичный Метод

Set the route collection instance.
public setRoutes ( Illuminate\Routing\RouteCollection $routes ) : void
$routes Illuminate\Routing\RouteCollection
Результат void

singularResourceParameters() публичный Метод

Set the unmapped global resource parameters to singular.
public singularResourceParameters ( boolean $singular = true ) : void
$singular boolean
Результат void

sortMiddleware() защищенный Метод

Sort the given middleware by priority.
protected sortMiddleware ( Collection $middlewares ) : array
$middlewares Illuminate\Support\Collection
Результат array

substituteBindings() публичный Метод

Substitute the route bindings onto the route.
public substituteBindings ( Illuminate\Routing\Route $route ) : Illuminate\Routing\Route
$route Illuminate\Routing\Route
Результат Illuminate\Routing\Route

substituteImplicitBindings() публичный Метод

Substitute the implicit Eloquent model bindings for the route.
public substituteImplicitBindings ( Illuminate\Routing\Route $route ) : void
$route Illuminate\Routing\Route
Результат void

updateGroupStack() защищенный Метод

Update the group stack with the given attributes.
protected updateGroupStack ( array $attributes ) : void
$attributes array
Результат void

uses() публичный Метод

Alias for the "currentRouteUses" method.
public uses ( ) : boolean
Результат boolean

Описание свойств

$binders защищенное свойство

The registered route value binders.
protected array $binders
Результат array

$container защищенное свойство

The IoC container instance.
protected Container,Illuminate\Container $container
Результат Illuminate\Container\Container

$current защищенное свойство

The currently dispatched route instance.
protected Route,Illuminate\Routing $current
Результат Illuminate\Routing\Route

$currentRequest защищенное свойство

The request currently being dispatched.
protected Request,Illuminate\Http $currentRequest
Результат Illuminate\Http\Request

$events защищенное свойство

The event dispatcher instance.
protected Dispatcher,Illuminate\Contracts\Events $events
Результат Illuminate\Contracts\Events\Dispatcher

$groupStack защищенное свойство

The route group attribute stack.
protected array $groupStack
Результат array

$middleware защищенное свойство

All of the short-hand keys for middlewares.
protected array $middleware
Результат array

$middlewareGroups защищенное свойство

All of the middleware groups.
protected array $middlewareGroups
Результат array

$middlewarePriority публичное свойство

Forces the listed middleware to always be in the given order.
public array $middlewarePriority
Результат array

$patterns защищенное свойство

The globally available parameter patterns.
protected array $patterns
Результат array

$routes защищенное свойство

The route collection instance.
protected RouteCollection,Illuminate\Routing $routes
Результат Illuminate\Routing\RouteCollection

$verbs публичное статическое свойство

All of the verbs supported by the router.
public static array $verbs
Результат array