/** * Show a custom page * * @param int $id The ID of the custom page * @param string $slug The unique slug * @return void */ public function show($id, $slug = null) { if ($id) { $customPage = CustomPage::whereId($id)->published()->firstOrFail(); } else { $customPage = CustomPage::whereSlug($slug)->published()->firstOrFail(); } $hasAccess = (user() and user()->hasAccess('internal')); if ($customPage->internal and !$hasAccess) { return $this->alertError(trans('app.access_denied')); } $customPage->access_counter++; $customPage->save(); $this->title($customPage->title); $this->pageView('pages::show_custom_page', compact('customPage')); }