interface UrlGenerator (View source)

Methods

string
current()

Get the current URL for the request.

string
previous(mixed $fallback = false)

Get the URL for the previous request.

string
to(string $path, mixed $extra = [], bool|null $secure = null)

Generate an absolute URL to the given path.

string
secure(string $path, array $parameters = [])

Generate a secure, absolute URL to the given path.

string
asset(string $path, bool|null $secure = null)

Generate the URL to an application asset.

string
route(string $name, mixed $parameters = [], bool $absolute = true)

Get the URL to a named route.

string
signedRoute(string $name, mixed $parameters = [], DateTimeInterface|DateInterval|int|null $expiration = null, bool $absolute = true)

Create a signed route URL for a named route.

string
temporarySignedRoute(string $name, DateTimeInterface|DateInterval|int $expiration, array $parameters = [], bool $absolute = true)

Create a temporary signed route URL for a named route.

string
action(string|array $action, mixed $parameters = [], bool $absolute = true)

Get the URL to a controller action.

string
getRootControllerNamespace()

Get the root controller namespace.

$this
setRootControllerNamespace(string $rootNamespace)

Set the root controller namespace.

string
query(string $path, array $query = '[]', mixed $extra = '[]', bool|null $secure = 'null')

No description

Details

string current()

Get the current URL for the request.

Return Value

string

string previous(mixed $fallback = false)

Get the URL for the previous request.

Parameters

mixed $fallback

Return Value

string

string to(string $path, mixed $extra = [], bool|null $secure = null)

Generate an absolute URL to the given path.

Parameters

string $path
mixed $extra
bool|null $secure

Return Value

string

string secure(string $path, array $parameters = [])

Generate a secure, absolute URL to the given path.

Parameters

string $path
array $parameters

Return Value

string

string asset(string $path, bool|null $secure = null)

Generate the URL to an application asset.

Parameters

string $path
bool|null $secure

Return Value

string

string route(string $name, mixed $parameters = [], bool $absolute = true)

Get the URL to a named route.

Parameters

string $name
mixed $parameters
bool $absolute

Return Value

string

Exceptions

InvalidArgumentException

string signedRoute(string $name, mixed $parameters = [], DateTimeInterface|DateInterval|int|null $expiration = null, bool $absolute = true)

Create a signed route URL for a named route.

Parameters

string $name
mixed $parameters
DateTimeInterface|DateInterval|int|null $expiration
bool $absolute

Return Value

string

Exceptions

InvalidArgumentException

string temporarySignedRoute(string $name, DateTimeInterface|DateInterval|int $expiration, array $parameters = [], bool $absolute = true)

Create a temporary signed route URL for a named route.

Parameters

string $name
DateTimeInterface|DateInterval|int $expiration
array $parameters
bool $absolute

Return Value

string

string action(string|array $action, mixed $parameters = [], bool $absolute = true)

Get the URL to a controller action.

Parameters

string|array $action
mixed $parameters
bool $absolute

Return Value

string

string getRootControllerNamespace()

Get the root controller namespace.

Return Value

string

$this setRootControllerNamespace(string $rootNamespace)

Set the root controller namespace.

Parameters

string $rootNamespace

Return Value

$this

string query(string $path, array $query = '[]', mixed $extra = '[]', bool|null $secure = 'null')

No description

Parameters

string $path
array $query
mixed $extra
bool|null $secure

Return Value

string

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.