コード例 #1
0
 public function run(Request $request)
 {
     $this->request = $request;
     $uri = $this->request->path();
     event('frontend.requested', [$uri]);
     $frontPage = FrontendPage::findByUri($uri);
     if ($frontPage instanceof FrontendPage) {
         if ($frontPage->isRedirect() and strlen($frontPage->getRedirectUrl()) > 0) {
             return redirect($frontPage->getRedirectUrl(), 301);
         } else {
             return $this->render($frontPage);
         }
     }
     if (config('cms.find_similar') and ($uri = FrontendPage::findSimilar($uri)) !== FALSE) {
         return redirect($uri, 301);
     }
     event('frontend.not_found', [$uri]);
     throw new PageNotFoundException();
 }
コード例 #2
0
 /**
  * @param string $uri
  *
  * @return string
  */
 public function executeRoute($uri)
 {
     if (empty($uri)) {
         return;
     }
     if (is_null($method = $this->getRouter()->findRouteByUri($uri))) {
         $this->page = FrontendPage::findByUri($uri, $this->page);
         return;
     }
     if (strpos($method, '::') !== false) {
         Callback::invoke($method, [$this]);
     } else {
         $this->{$method}();
     }
     return $method;
 }