PHP Класс Illuminate\Routing\UrlGenerator

Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$cachedRoot string | null A cached copy of the URL root for the current request.
$cachedSchema string | null A cached copy of the URL schema for the current request.
$dontEncode array Characters that should not be URL encoded.
$forceSchema string The forced schema for URLs.
$forcedRoot string The forced URL root.
$formatHostUsing Closure The callback to use to format hosts.
$formatPathUsing Closure The callback to use to format paths.
$request Illuminate\Http\Request The request instance.
$rootNamespace string The root namespace being applied to controller actions.
$routes Illuminate\Routing\RouteCollection The route collection.
$sessionResolver callable The session resolver callable.

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

Метод Описание
__construct ( RouteCollection $routes, Illuminate\Http\Request $request ) : void Create a new URL Generator instance.
action ( string $action, mixed $parameters = [], boolean $absolute = true ) : string Get the URL to a controller action.
asset ( string $path, boolean | null $secure = null ) : string Generate the URL to an application asset.
assetFrom ( string $root, string $path, boolean | null $secure = null ) : string Generate the URL to an asset from a custom root domain such as CDN, etc.
current ( ) : string Get the current URL for the request.
forceRootUrl ( string $root ) : void Set the forced root URL.
forceSchema ( string $schema ) : void Force the schema for URLs.
formatHostUsing ( Closur\Closure $callback ) Set a callback to be used to format the host of generated URLs.
formatPathUsing ( Closur\Closure $callback ) Set a callback to be used to format the path of generated URLs.
full ( ) : string Get the full URL for the current request.
getRequest ( ) : Illuminate\Http\Request Get the request instance.
isValidUrl ( string $path ) : boolean Determine if the given path is a valid URL.
pathFormatter ( ) : Closure Get the path formatter being used by the URL generator.
previous ( mixed $fallback = false ) : string Get the URL for the previous request.
route ( string $name, mixed $parameters = [], boolean $absolute = true ) : string Get the URL to a named route.
secure ( string $path, array $parameters = [] ) : string Generate a secure, absolute URL to the given path.
secureAsset ( string $path ) : string Generate the URL to a secure asset.
setRequest ( Illuminate\Http\Request $request ) : void Set the current request instance.
setRootControllerNamespace ( string $rootNamespace ) Set the root controller namespace.
setRoutes ( RouteCollection $routes ) Set the route collection.
setSessionResolver ( callable $sessionResolver ) Set the session resolver for the generator.
to ( string $path, mixed $extra = [], boolean | null $secure = null ) : string Generate an absolute URL to the given path.

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

Метод Описание
addPortToDomain ( string $domain ) : string Add the port to the domain if necessary.
addQueryString ( string $uri, array $parameters ) : mixed | string Add a query string to the URI.
buildCompleteUrl ( string $root, string $path, string $tail = '' ) : string Format the given URL segments into a single URL.
formatDomain ( Illuminate\Routing\Route $route, array &$parameters ) : string Format the domain and port for the route and request.
formatParameters ( mixed | array $parameters ) : array Format the array of URL parameters.
getDomainAndScheme ( Illuminate\Routing\Route $route ) : string Get the domain and scheme for the route.
getNumericParameters ( array $parameters ) : array Get the numeric parameters from a given list.
getPreviousUrlFromSession ( ) : string | null Get the previous URL from the session if possible.
getRootUrl ( string $scheme, string $root = null ) : string Get the base URL for the request.
getRouteDomain ( Illuminate\Routing\Route $route, array &$parameters ) : string Get the formatted domain for a given route.
getRouteQueryString ( array $parameters ) : string Get the query string for a given route.
getRouteRoot ( Illuminate\Routing\Route $route, string $domain ) : string Get the root of the route URL.
getRouteScheme ( Illuminate\Routing\Route $route ) : string Get the scheme for the given route.
getScheme ( boolean | null $secure ) : string Get the scheme for a raw URL.
getSession ( ) : Illuminate\Session\Store | null Get the session implementation from the resolver.
getStringParameters ( array $parameters ) : array Get the string parameters from a given list.
removeIndex ( string $root ) : string Remove the index.php file from a path.
replaceNamedParameters ( string $path, array &$parameters ) : string Replace all of the named parameters in the path.
replaceRoot ( Illuminate\Routing\Route $route, string $domain, array &$parameters ) : string Replace the parameters on the root path.
replaceRoutableParameters ( array $parameters = [] ) : array Replace UrlRoutable parameters with their route parameter.
replaceRouteParameters ( string $path, array &$parameters ) : string Replace all of the wildcard parameters for a route path.
toRoute ( Illuminate\Routing\Route $route, mixed $parameters, boolean $absolute ) : string Get the URL for a given route instance.

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

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

Create a new URL Generator instance.
public __construct ( RouteCollection $routes, Illuminate\Http\Request $request ) : void
$routes RouteCollection
$request Illuminate\Http\Request
Результат void

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

Get the URL to a controller action.
public action ( string $action, mixed $parameters = [], boolean $absolute = true ) : string
$action string
$parameters mixed
$absolute boolean
Результат string

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

Add the port to the domain if necessary.
protected addPortToDomain ( string $domain ) : string
$domain string
Результат string

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

Add a query string to the URI.
protected addQueryString ( string $uri, array $parameters ) : mixed | string
$uri string
$parameters array
Результат mixed | string

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

Generate the URL to an application asset.
public asset ( string $path, boolean | null $secure = null ) : string
$path string
$secure boolean | null
Результат string

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

Generate the URL to an asset from a custom root domain such as CDN, etc.
public assetFrom ( string $root, string $path, boolean | null $secure = null ) : string
$root string
$path string
$secure boolean | null
Результат string

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

Format the given URL segments into a single URL.
protected buildCompleteUrl ( string $root, string $path, string $tail = '' ) : string
$root string
$path string
$tail string
Результат string

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

Get the current URL for the request.
public current ( ) : string
Результат string

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

Set the forced root URL.
public forceRootUrl ( string $root ) : void
$root string
Результат void

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

Force the schema for URLs.
public forceSchema ( string $schema ) : void
$schema string
Результат void

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

Format the domain and port for the route and request.
protected formatDomain ( Illuminate\Routing\Route $route, array &$parameters ) : string
$route Illuminate\Routing\Route
$parameters array
Результат string

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

Set a callback to be used to format the host of generated URLs.
public formatHostUsing ( Closur\Closure $callback )
$callback Closur\Closure

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

Format the array of URL parameters.
protected formatParameters ( mixed | array $parameters ) : array
$parameters mixed | array
Результат array

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

Set a callback to be used to format the path of generated URLs.
public formatPathUsing ( Closur\Closure $callback )
$callback Closur\Closure

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

Get the full URL for the current request.
public full ( ) : string
Результат string

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

Get the domain and scheme for the route.
protected getDomainAndScheme ( Illuminate\Routing\Route $route ) : string
$route Illuminate\Routing\Route
Результат string

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

Get the numeric parameters from a given list.
protected getNumericParameters ( array $parameters ) : array
$parameters array
Результат array

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

Get the previous URL from the session if possible.
protected getPreviousUrlFromSession ( ) : string | null
Результат string | null

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

Get the request instance.
public getRequest ( ) : Illuminate\Http\Request
Результат Illuminate\Http\Request

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

Get the base URL for the request.
protected getRootUrl ( string $scheme, string $root = null ) : string
$scheme string
$root string
Результат string

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

Get the formatted domain for a given route.
protected getRouteDomain ( Illuminate\Routing\Route $route, array &$parameters ) : string
$route Illuminate\Routing\Route
$parameters array
Результат string

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

Get the query string for a given route.
protected getRouteQueryString ( array $parameters ) : string
$parameters array
Результат string

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

Get the root of the route URL.
protected getRouteRoot ( Illuminate\Routing\Route $route, string $domain ) : string
$route Illuminate\Routing\Route
$domain string
Результат string

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

Get the scheme for the given route.
protected getRouteScheme ( Illuminate\Routing\Route $route ) : string
$route Illuminate\Routing\Route
Результат string

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

Get the scheme for a raw URL.
protected getScheme ( boolean | null $secure ) : string
$secure boolean | null
Результат string

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

Get the session implementation from the resolver.
protected getSession ( ) : Illuminate\Session\Store | null
Результат Illuminate\Session\Store | null

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

Get the string parameters from a given list.
protected getStringParameters ( array $parameters ) : array
$parameters array
Результат array

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

Determine if the given path is a valid URL.
public isValidUrl ( string $path ) : boolean
$path string
Результат boolean

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

Get the path formatter being used by the URL generator.
public pathFormatter ( ) : Closure
Результат Closure

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

Get the URL for the previous request.
public previous ( mixed $fallback = false ) : string
$fallback mixed
Результат string

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

Remove the index.php file from a path.
protected removeIndex ( string $root ) : string
$root string
Результат string

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

Replace all of the named parameters in the path.
protected replaceNamedParameters ( string $path, array &$parameters ) : string
$path string
$parameters array
Результат string

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

Replace the parameters on the root path.
protected replaceRoot ( Illuminate\Routing\Route $route, string $domain, array &$parameters ) : string
$route Illuminate\Routing\Route
$domain string
$parameters array
Результат string

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

Replace UrlRoutable parameters with their route parameter.
protected replaceRoutableParameters ( array $parameters = [] ) : array
$parameters array
Результат array

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

Replace all of the wildcard parameters for a route path.
protected replaceRouteParameters ( string $path, array &$parameters ) : string
$path string
$parameters array
Результат string

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

Get the URL to a named route.
public route ( string $name, mixed $parameters = [], boolean $absolute = true ) : string
$name string
$parameters mixed
$absolute boolean
Результат string

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

Generate a secure, absolute URL to the given path.
public secure ( string $path, array $parameters = [] ) : string
$path string
$parameters array
Результат string

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

Generate the URL to a secure asset.
public secureAsset ( string $path ) : string
$path string
Результат string

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

Set the current request instance.
public setRequest ( Illuminate\Http\Request $request ) : void
$request Illuminate\Http\Request
Результат void

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

Set the root controller namespace.
public setRootControllerNamespace ( string $rootNamespace )
$rootNamespace string

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

Set the route collection.
public setRoutes ( RouteCollection $routes )
$routes RouteCollection

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

Set the session resolver for the generator.
public setSessionResolver ( callable $sessionResolver )
$sessionResolver callable

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

Generate an absolute URL to the given path.
public to ( string $path, mixed $extra = [], boolean | null $secure = null ) : string
$path string
$extra mixed
$secure boolean | null
Результат string

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

Get the URL for a given route instance.
protected toRoute ( Illuminate\Routing\Route $route, mixed $parameters, boolean $absolute ) : string
$route Illuminate\Routing\Route
$parameters mixed
$absolute boolean
Результат string

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

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

A cached copy of the URL root for the current request.
protected string|null $cachedRoot
Результат string | null

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

A cached copy of the URL schema for the current request.
protected string|null $cachedSchema
Результат string | null

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

Characters that should not be URL encoded.
protected array $dontEncode
Результат array

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

The forced schema for URLs.
protected string $forceSchema
Результат string

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

The forced URL root.
protected string $forcedRoot
Результат string

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

The callback to use to format hosts.
protected Closure $formatHostUsing
Результат Closure

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

The callback to use to format paths.
protected Closure $formatPathUsing
Результат Closure

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

The request instance.
protected Request,Illuminate\Http $request
Результат Illuminate\Http\Request

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

The root namespace being applied to controller actions.
protected string $rootNamespace
Результат string

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

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

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

The session resolver callable.
protected callable $sessionResolver
Результат callable