123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php namespace System;
- class Redirect {
-
- public static function to($url, $method = 'location', $status = 302, $https = false)
- {
- $url = URL::to($url, $https);
- return ($method == 'refresh')
- ? Response::make('', $status)->header('Refresh', '0;url='.$url)
- : Response::make('', $status)->header('Location', $url);
- }
-
- public static function to_secure($url, $method = 'location', $status = 302)
- {
- return static::to($url, $method, $status, true);
- }
-
- public static function __callStatic($method, $parameters)
- {
-
-
-
- if (strpos($method, 'to_secure_') === 0)
- {
- return static::to(URL::to_route(substr($method, 10), $parameters, true));
- }
-
-
-
- if (strpos($method, 'to_') === 0)
- {
- return static::to(URL::to_route(substr($method, 3), $parameters));
- }
- throw new \Exception("Method [$method] is not defined on the Redirect class.");
- }
- }
|