pageRepo = $pageRepo; } /** * Show the page * * @param $slug * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function show($slug) { $page = $this->pageRepo->findWhere(['slug' => $slug])->first(); if (!$page) { throw new PageNotFound(new Exception('Page not found')); } return view('pages.index', ['page' => $page]); } }