public static function install() { Hook::attach('pageLoaded', function ($page) { if (!empty($page->redirect)) { $url = RedirectPlugin::getUrl($page->redirect); $status = RedirectPlugin::getStatus($page->redirect); $response = new RedirectResponse($url, $status); $response->send(); } }); }
/** * @param string $route * @param int $status * @return void */ public function functionRedirect($route, $status = 302) { $url = $this->urlGenerator->generateAbsolute($route); $response = new RedirectResponse($url, $status); $response->send(); }