page = ModelsPage::where('slug', $fallbackPlaceholder)->firstOrFail(); if (!$this->page->visible) { abort(404); } // Validate if user is logged in if ($this->page->visibility == 'client' && !auth()->check()) { abort(404); } if ($this->page->visibility == 'admin' && (!auth()->check() || is_null(auth()->user()->role))) { abort(404); } } public function render() { return view('others.pages::page', [ 'page' => $this->page, ])->layout('layouts.app', [ 'title' => $this->page->title, 'description' => $this->page->description, 'sidebar' => $this->page->navigation == 'dashboard' ? true : false, ]); } }