class RouteUrlGenerator (View source)

Properties

protected UrlGenerator $url

The URL generator instance.

protected Request $request

The request instance.

array $defaultParameters

The named parameter defaults.

array $dontEncode

Characters that should not be URL encoded.

Methods

void
__construct(UrlGenerator $url, Request $request)

Create a new Route URL generator.

string
to(Route $route, array $parameters = [], bool $absolute = false)

Generate a URL for the given route.

string
getRouteDomain(Route $route, array $parameters)

Get the formatted domain for a given route.

string
formatDomain(Route $route, array $parameters)

Format the domain and port for the route and request.

string
getRouteScheme(Route $route)

Get the scheme for the given route.

string
addPortToDomain(string $domain)

Add the port to the domain if necessary.

string
replaceRootParameters(Route $route, string $domain, array $parameters)

Replace the parameters on the root path.

string
replaceRouteParameters(string $path, array $parameters)

Replace all of the wildcard parameters for a route path.

string
replaceNamedParameters(string $path, array $parameters)

Replace all of the named parameters in the path.

mixed|string
addQueryString(string $uri, array $parameters)

Add a query string to the URI.

string
getRouteQueryString(array $parameters)

Get the query string for a given route.

array
getStringParameters(array $parameters)

Get the string parameters from a given list.

array
getNumericParameters(array $parameters)

Get the numeric parameters from a given list.

void
defaults(array $defaults)

Set the default named parameters used by the URL generator.

Details

void __construct(UrlGenerator $url, Request $request)

Create a new Route URL generator.

Parameters

UrlGenerator $url
Request $request

Return Value

void

string to(Route $route, array $parameters = [], bool $absolute = false)

Generate a URL for the given route.

Parameters

Route $route
array $parameters
bool $absolute

Return Value

string

Exceptions

UrlGenerationException

protected string getRouteDomain(Route $route, array $parameters)

Get the formatted domain for a given route.

Parameters

Route $route
array $parameters

Return Value

string

protected string formatDomain(Route $route, array $parameters)

Format the domain and port for the route and request.

Parameters

Route $route
array $parameters

Return Value

string

protected string getRouteScheme(Route $route)

Get the scheme for the given route.

Parameters

Route $route

Return Value

string

protected string addPortToDomain(string $domain)

Add the port to the domain if necessary.

Parameters

string $domain

Return Value

string

protected string replaceRootParameters(Route $route, string $domain, array $parameters)

Replace the parameters on the root path.

Parameters

Route $route
string $domain
array $parameters

Return Value

string

protected string replaceRouteParameters(string $path, array $parameters)

Replace all of the wildcard parameters for a route path.

Parameters

string $path
array $parameters

Return Value

string

protected string replaceNamedParameters(string $path, array $parameters)

Replace all of the named parameters in the path.

Parameters

string $path
array $parameters

Return Value

string

protected mixed|string addQueryString(string $uri, array $parameters)

Add a query string to the URI.

Parameters

string $uri
array $parameters

Return Value

mixed|string

protected string getRouteQueryString(array $parameters)

Get the query string for a given route.

Parameters

array $parameters

Return Value

string

protected array getStringParameters(array $parameters)

Get the string parameters from a given list.

Parameters

array $parameters

Return Value

array

protected array getNumericParameters(array $parameters)

Get the numeric parameters from a given list.

Parameters

array $parameters

Return Value

array

void defaults(array $defaults)

Set the default named parameters used by the URL generator.

Parameters

array $defaults

Return Value

void

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.