W3cubDocs

/Laravel 4.2

UrlGenerator

class UrlGenerator (View source)

Methods

void __construct(RouteCollection $routes, Request $request)

Create a new URL Generator instance.

string full()

Get the full URL for the current request.

string current()

Get the current URL for the request.

string previous()

Get the URL for the previous request.

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

Generate a absolute URL to the given path.

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

Generate a secure, absolute URL to the given path.

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

Generate a URL to an application asset.

string secureAsset(string $path)

Generate a URL to a secure asset.

void forceSchema(string $schema)

Force the schema for URLs.

string route(string $name, mixed $parameters = array(), bool $absolute = true, Route $route = null)

Get the URL to a named route.

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

Get the URL to a controller action.

void forceRootUrl(string $root)

Set the forced root URL.

bool isValidUrl(string $path)

Determine if the given path is a valid URL.

Request getRequest()

Get the request instance.

void setRequest(Request $request)

Set the current request instance.

Details

void __construct(RouteCollection $routes, Request $request)

Create a new URL Generator instance.

Parameters

RouteCollection $routes
Request $request

Return Value

void

string full()

Get the full URL for the current request.

Return Value

string

string current()

Get the current URL for the request.

Return Value

string

string previous()

Get the URL for the previous request.

Return Value

string

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

Generate a absolute URL to the given path.

Parameters

string $path
mixed $extra
bool|null $secure

Return Value

string

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

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 a URL to an application asset.

Parameters

string $path
bool|null $secure

Return Value

string

string secureAsset(string $path)

Generate a URL to a secure asset.

Parameters

string $path

Return Value

string

void forceSchema(string $schema)

Force the schema for URLs.

Parameters

string $schema

Return Value

void

string route(string $name, mixed $parameters = array(), bool $absolute = true, Route $route = null)

Get the URL to a named route.

Parameters

string $name
mixed $parameters
bool $absolute
Route $route

Return Value

string

Exceptions

InvalidArgumentException

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

Get the URL to a controller action.

Parameters

string $action
mixed $parameters
bool $absolute

Return Value

string

void forceRootUrl(string $root)

Set the forced root URL.

Parameters

string $root

Return Value

void

bool isValidUrl(string $path)

Determine if the given path is a valid URL.

Parameters

string $path

Return Value

bool

Request getRequest()

Get the request instance.

Return Value

Request

void setRequest(Request $request)

Set the current request instance.

Parameters

Request $request

Return Value

void

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/4.2/Illuminate/Routing/UrlGenerator.html