refactor redirect class.
This commit is contained in:
parent
09feb52db9
commit
7ebcdf57c5
|
|
@ -24,12 +24,12 @@ public function __construct($response)
|
||||||
* Create a redirect response.
|
* Create a redirect response.
|
||||||
*
|
*
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @param string $method
|
|
||||||
* @param int $status
|
* @param int $status
|
||||||
|
* @param string $method
|
||||||
* @param bool $https
|
* @param bool $https
|
||||||
* @return Redirect
|
* @return Redirect
|
||||||
*/
|
*/
|
||||||
public static function to($url, $method = 'location', $status = 302, $https = false)
|
public static function to($url, $status = 302, $method = 'location', $https = false)
|
||||||
{
|
{
|
||||||
$url = URL::to($url, $https);
|
$url = URL::to($url, $https);
|
||||||
|
|
||||||
|
|
@ -42,13 +42,13 @@ public static function to($url, $method = 'location', $status = 302, $https = fa
|
||||||
* Create a redirect response to a HTTPS URL.
|
* Create a redirect response to a HTTPS URL.
|
||||||
*
|
*
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @param string $method
|
|
||||||
* @param int $status
|
* @param int $status
|
||||||
|
* @param string $method
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public static function to_secure($url, $method = 'location', $status = 302)
|
public static function to_secure($url, $status = 302, $method = 'location')
|
||||||
{
|
{
|
||||||
return static::to($url, $method, $status, true);
|
return static::to($url, $status, $method, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public static function to($url = '', $https = false, $asset = false)
|
||||||
$base = 'https://'.substr($base, 7);
|
$base = 'https://'.substr($base, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rtrim($base, '/').'/'.ltrim($url, '/');
|
return rtrim($base, '/').'/'.trim($url, '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue