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