Пример #1
0
 public function run()
 {
     // Layouts
     $redirections = (require_once 'redirections.php');
     foreach ($redirections as $redirection) {
         $model = Redirection::create($redirection);
     }
 }
Пример #2
0
 public function onRun()
 {
     $redirections = Redirection::all();
     CW::info($redirections);
     $url = Request::url();
     CW::info($url);
     foreach ($redirections as $redirect) {
         // $rule = new RegExp();
         if (preg_match($redirect->rule_regexp, $url)) {
             CW::info(['Redirect' => $redirect]);
             return Redirect::to($redirect->url, $redirect->redirect_type);
         }
     }
 }