コード例 #1
0
 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();
         }
     });
 }
コード例 #2
0
 /**
  * @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();
 }