/** * Handle a navigation.bar event third. * * @return void */ public function onNavigationBarThird() { if ($this->credentials->check()) { // add the view users link if ($this->credentials->hasAccess('mod')) { $this->navigation->addToBar(['title' => 'View Users', 'slug' => 'users', 'icon' => 'user']); } // add the create user link if ($this->credentials->hasAccess('admin')) { $this->navigation->addToBar(['title' => 'Create User', 'slug' => 'users/create', 'icon' => 'star']); } // add the create page link if ($this->credentials->hasAccess('edit')) { $this->navigation->addToBar(['title' => 'Create Page', 'slug' => 'pages/create', 'icon' => 'pencil']); } // add the create post link if ($this->blogging) { if ($this->credentials->hasAccess('blog')) { $this->navigation->addToBar(['title' => 'Create Post', 'slug' => 'blog/posts/create', 'icon' => 'book']); } } // add the create event link if ($this->events) { if ($this->credentials->hasAccess('edit')) { $this->navigation->addToBar(['title' => 'Create Event', 'slug' => 'events/create', 'icon' => 'calendar']); } } } }
/** * Handle a navigation.bar event third. * * @return void */ public function onNavigationBarThird() { if ($this->credentials->check()) { // add the view users link if ($this->credentials->hasAccess('mod')) { $this->navigation->addToBar(['title' => trans('navigation.users'), 'slug' => 'users', 'icon' => 'user']); } // add the create user link if ($this->credentials->hasAccess('admin')) { $this->navigation->addToBar(['title' => trans('navigation.new_user'), 'slug' => 'users/create', 'icon' => 'star']); } // add the create page link if ($this->credentials->hasAccess('edit')) { $this->navigation->addToBar(['title' => trans('navigation.new_page'), 'slug' => 'pages/create', 'icon' => 'pencil']); } // add the create post link if (Config::get('cms.blogging')) { if ($this->credentials->hasAccess('blog')) { $this->navigation->addToBar(['title' => trans('navigation.new_post'), 'slug' => 'content/posts/create', 'icon' => 'book']); } } // add the create event link if (Config::get('cms.events')) { if ($this->credentials->hasAccess('edit')) { $this->navigation->addToBar(['title' => trans('navigation.new_event'), 'slug' => 'events/create', 'icon' => 'calendar']); } } } }
/** * Create a navigation bar. * * @param string $type * * @return string */ public function make($type = 'default') { if ($this->credentials->check()) { if ($type === 'admin') { if ($this->credentials->hasAccess('admin')) { // the requested type is admin, and the user is an admin return $this->navigation->render('admin', 'admin', ['title' => 'Admin Panel', 'side' => $this->getSide(), 'inverse' => $this->inverse]); } else { // the requested type is admin, and the user is NOT an admin return $this->navigation->render('default', 'default', ['title' => $this->name, 'side' => $this->getSide(), 'inverse' => $this->inverse]); } } else { // the requested type is default, and the user is logged in return $this->navigation->render('default', 'default', ['title' => $this->name, 'side' => $this->getSide(), 'inverse' => $this->inverse]); } } else { // the requested type is default, and the user is NOT logged in return $this->navigation->render('default', false, ['title' => $this->name, 'inverse' => $this->inverse]); } }
/** * Get the view instance. * * @return \Illuminate\Contracts\View\Factory * @static */ public static function getView() { return \GrahamCampbell\Navigation\Navigation::getView(); }