page = (new PageModel())->where('slug', $params[0])->first() ) { return $this->{$method}(); } throw PageNotFoundException::forPageNotFound(); } public function index(): string { $cacheName = "page-{$this->page->slug}"; if (! ($found = cache($cacheName))) { $data = [ 'page' => $this->page, ]; $found = view('page', $data); // The page cache is set to a decade so it is deleted manually upon page update cache() ->save($cacheName, $found, DECADE); } return $found; } }