redirect() public static method

Redirect to URL
public static redirect ( string $url ) : void
$url string
return void
Example #1
0
 /**
  * Test Helper Redirect
  *
  * @expectedException \Bluz\Application\Exception\RedirectException
  */
 public function testHelperRedirect()
 {
     Response::redirect('/');
 }
Example #2
0
    } elseif (Request::isPost()) {
        try {
            if (empty($login)) {
                throw new Exception("Login is empty");
            }
            if (empty($password)) {
                throw new Exception("Password is empty");
            }
            // login/password
            // throw AuthException
            Auth\Table::getInstance()->authenticateEquals($login, $password);
            if ($rememberMe) {
                Auth\Table::getInstance()->generateCookie();
            }
            Messages::addNotice('You are signed');
            // try to rollback to previous called URL
            if ($rollback = Session::get('rollback')) {
                Session::delete('rollback');
                Response::redirect($rollback);
            }
            // try back to index
            Response::redirectTo('index', 'index');
        } catch (Exception $e) {
            Messages::addError($e->getMessage());
            return ['login' => $login];
        } catch (AuthException $e) {
            Messages::addError($e->getMessage());
            return ['login' => $login];
        }
    }
};