Commit 188394ba authored by Taylor Otwell's avatar Taylor Otwell

added url::home

parent 75280a9f
......@@ -11,17 +11,7 @@ class Redirect extends Response {
*/
public static function home($status = 302, $https = false)
{
$route = Router::find('home');
// If a route named "home" exists, we'll route to that instead of using
// the single slash root URI. THis allows the HTTPS attribute to be
// respected instead of being hard-coded in the redirect.
if ( ! is_null($route))
{
return static::to_route('home', $status);
}
return static::to('/', $status, $https);
return static::to(URL::home($https), $status);
}
/**
......
......@@ -29,6 +29,27 @@ class URL {
return static::to(URI::current());
}
/**
* Get the URL for the application root.
*
* @param bool $https
* @return string
*/
public static function home($https = false)
{
$route = Router::find('home');
// If a route named "home" exists, we'll route to that instead of using
// the single slash root URI. THis allows the HTTPS attribute to be
// respected instead of being hard-coded in the redirect.
if ( ! is_null($route))
{
return static::to_route('home');
}
return static::to('/', $https);
}
/**
* Get the base URL of the application.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment