/** * 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 navigation bar html. * * @param string $mainName * @param string|bool $barName * @param array|null $data * @return string * @static */ public static function render($mainName = 'default', $barName = false, $data = null) { return \GrahamCampbell\Navigation\Navigation::render($mainName, $barName, $data); }