Commit 55669ee0 by Taylor Otwell

added redirect::back method.

parent 364c39da
...@@ -15,6 +15,17 @@ class Redirect extends Response { ...@@ -15,6 +15,17 @@ class Redirect extends Response {
} }
/** /**
* Create a redirect response to the HTTP referrer.
*
* @param int $status
* @return Redirect
*/
public static function back($status = 302)
{
return static::to(Request::referrer(), $status);
}
/**
* Create a redirect response. * Create a redirect response.
* *
* <code> * <code>
......
...@@ -132,6 +132,16 @@ class Request { ...@@ -132,6 +132,16 @@ class Request {
} }
/** /**
* Get the HTTP referrer for the request.
*
* @return string
*/
public static function referrer()
{
return array_get($_SERVER, 'HTTP_REFERER');
}
/**
* Determine if the current request is via the command line. * Determine if the current request is via the command line.
* *
* @return bool * @return bool
......
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