added redirect::home
This commit is contained in:
parent
14c9d38270
commit
3f44103760
|
@ -1,7 +1,29 @@
|
|||
<?php namespace Laravel;
|
||||
<?php namespace Laravel; use Laravel\Routing\Router;
|
||||
|
||||
class Redirect extends Response {
|
||||
|
||||
/**
|
||||
* Create a redirect response to application root.
|
||||
*
|
||||
* @param int $status
|
||||
* @param bool $secure
|
||||
* @return Redirect
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a redirect response.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue