RouteUrlGenerator
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
Add the port to the domain if necessary.
Replace the parameters on the root path.
Replace all of the wildcard parameters for a route path.
Replace all of the named parameters in the path.
Add a query string to the URI.
Get the query string for a given route.
Get the string parameters from a given list.
Get the numeric parameters from a given list.
Set the default named parameters used by the URL generator.
Details
__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.
protected string|null
getRouteDomain(Route $route, array $parameters)
Get the formatted domain for a given route.
protected string
formatDomain(Route $route, array $parameters)
Format the domain and port for the route and request.
protected string
getRouteScheme(Route $route)
Get the scheme for the given route.
protected string
addPortToDomain(string $domain)
Add the port to the domain if necessary.
protected array
formatParameters(Route $route, mixed $parameters)
Format the array of route parameters.
protected string
replaceRootParameters(Route $route, string $domain, array $parameters)
Replace the parameters on the root path.
protected string
replaceRouteParameters(string $path, array $parameters)
Replace all of the wildcard parameters for a route path.
protected string
replaceNamedParameters(string $path, array $parameters)
Replace all of the named parameters in the path.
protected mixed
addQueryString(string $uri, array $parameters)
Add a query string to the URI.
protected string
getRouteQueryString(array $parameters)
Get the query string for a given route.
protected array
getStringParameters(array $parameters)
Get the string parameters from a given list.
protected 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.
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.