/** * if it is ajax request - will be outputted json: 'redirect' => 'url' * if it is simple request - header "Location" will be sent. * * @param \KZ\link\interfaces\Link|string $url * @return void */ public function redirect($url) { if ($url instanceof Link) { $url = $url->getLink(); } if ($this->request->isAjaxRequest()) { $this->json(['redirect' => $url]); } else { header('Location: ' . $url); } if ($this->exitAfterRedirect) { exit; } }
public function __construct() { $route = isset($_GET['r']) ? $_GET['r'] : ''; parent::__construct($route); }