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(); }