Get all the navigation to render
Hide hidden
Order by list order
Group by parent_id
@return mixed
970352
public static function getAllByParentGrouped()
    {
        $roles = false;
        if (method_exists(user(), 'roles') && method_exists(user(), 'getRolesList')) {
            $roles = true;
        }

        $builder = self::where('is_hidden', 0);

        // if roles are defined on user
        if ($roles) {
            $roles = user()->getRolesList();
            $builder->whereHas('roles', function ($query) use ($roles) {
                return $query->whereIn('roles.id', $roles);
            });
        }

        $items = $builder->orderBy('list_order')
            ->select('id', 'title', 'slug', 'url', 'icon', 'parent_id')
            ->get()
            ->groupBy('parent_id');

        if (count($items)) {
            $items['root'] = collect();
            if (isset($items[''])) {
                $items['root'] = $items[''];
                unset($items['']);
            }
            if (isset($items[0])) {
                $items['root'] = $items[0];
                unset($items[0]);
            }
        }

        return $items;
    }
348302
static public function getMapIdParent()
    {
        if (self::$_mapIdParent)
        {
            return self::$_mapIdParent;
        }

        $model = Cache::remember('map_tree', self::$lifeCache, function()
        {
            return DB::table('menus')->get();
        });

        $map = array();

        foreach ($model as $val)
        {
            $map[$val->id] = $val->parent_id;
        }
        unset($val);
        
        self::$_mapIdParent = $map;
       
        return $map;
    }
1350565
public function getNavUrlParams()
    {
        if (($sParams = $this->getViewConfigParam('navurlparams')) === null) {
            $sParams = '';
            $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
            foreach ($aNavParams as $sName => $sValue) {
                if (isset($sValue)) {
                    if ($sParams) {
                        $sParams .= '&amp;';
                    }
                    $sParams .= "{$sName}=" . rawurlencode($sValue);
                }
            }
            if ($sParams) {
                $sParams = '&amp;' . $sParams;
            }
            $this->setViewConfigParam('navurlparams', $sParams);
        }

        return $sParams;
    }
84577
public function parent()
    {
        return $this->filter([
            'lft__lt' => $this->getModel()->lft,
            'rgt__gt' => $this->getModel()->rgt,
            'level' => $this->getModel()->level - 1,
            'root' => $this->getModel()->root,
        ]);
    }
135961
public function navigationStatus(): string
    {
        return trans('tablelist::tablelist.tfoot.nav', [
            'start' => ($this->getAttribute('list')->perPage()
                        * ($this->getAttribute('list')->currentPage() - 1))
                       + 1,
            'stop'  => $this->getAttribute('list')->count()
                       + (($this->getAttribute('list')->currentPage() - 1)
                          * $this->getAttribute('list')->perPage()),
            'total' => $this->getAttribute('list')->total(),
        ]);
    }
832204
public function getCurrentOrder()
    {
        $order = $this->_getData('blog_current_order');
        if ($order) {
            return $order;
        }

        $orders = $this->getAvailableOrders();
        $defaultOrder = $this->getOrderField();

        if (!isset($orders[$defaultOrder])) {
            $keys = array_keys($orders);
            $defaultOrder = $keys[0];
        }

        $order = $this->toolbarModel->getOrder();
        if (!$order || !isset($orders[$order])) {
            $order = $defaultOrder;
        }

        if ($order != $defaultOrder) {
            $this->memorizeParam('sort_order', $order);
        }

        $this->setData('blog_current_order', $order);

        return $order;
    }
443679
public function getParentPseudoPage()
    {
        $page = $this->getPseudoPage();
        if ($page && $page->parent) {
            return $page->parent->getPseudoPage();
        }
        return null;
    }
999769
public function renderAction()
    {
        $params     = $this->params();
        $navigation = $this->getServiceLocator()
                           ->get( 'Grid\Menu\Model\Menu\Model' )
                           ->findNavigation( $params->fromRoute( 'id' ) );

        $view = new ViewModel( array(
            'navigation' => $navigation,
            'class'      => $params->fromRoute( 'class' ),
        ) );

        return $view->setTerminal( true );
    }
532335
protected function findCurrentPage()
    {
        $url = $this->getCurrentUrl();
        $sections = $this->getCurrentUrlSections();

        // laravel removes last / get home / dashboard
        if ($url === false) {
            $page = Page::where('slug', '/')->get()->first();
        }
        else {
            // find nav with url - get last (parent can have same url)
            $page = Page::where('url', $url)
                ->orderBy('is_hidden', 'DESC')
                ->orderBy('url_parent_id')
                ->orderBy('header_order')
                ->get()
                ->last();
        }

        // we assume some params / reserved word is at the end
        if (!$page && strlen($url) > 2) {
            // keep cutting off from url until we find him in the db
            foreach ($sections as $key => $slug) {
                $url = substr($url, 0, strripos($url, '/'));

                // find nav with url - get last (parent can have same url)
                $page = Page::whereUrl($url)->get()->last();
                if ($page) {
                    break;
                }
            }
        }

        // when nothing - fall back to home
        if (!$page) {
            $page = Page::find(1);
            if (config('app.env') == 'local' && !$page) {
                dd('Whoops. Page not found - please see if url is in the pages table');
            }
        }

        // set the selected navigation
        $this->page = $page;

        // get all navigations -> ON parent_id
        $this->parentPages = $page->getParentsAndYou();

        // get all navigations -> ON url_parent_id
        $this->urlParentPages = $page->getUrlParentsAndYou();

        $this->page->increment('views');

        return $this->page;
    }
1127509
public function getParentPseudoPageOrRoot()
    {
        $page = $this->getPseudoPage();
        if ($page && $page->parent) {
            return $page->parent->getPseudoPageOrRoot();
        }
        return null;
    }
1048904
public function index()
  {
    if ( \Auth::user()->roles[0]->can('menu-read' ) ) {
      $items = $this->menus->with('roles')
      ->where('parent_id', '=', '0')
      ->orderBy('sort_order', 'ASC')->get();
      return \View::make('acl::admin.menus.index', [
        'items'   =>  $items,
        'title'   => 'list',
      ]);
    }
    return \Redirect::route('admin.menus.index')->withErrors(trans('acl::dashboard.unauthorized_access'));
  }
197569
public function getOrdered()
    {
        if (!$this->sort) {
            return $this->content;
        }

        $unordered = [];
        foreach ($this->content as $content) {
            $unordered[$content->getId()] = $content;
        }

        $ordered = [];
        $sort = json_decode($this->sort, true);
        $order = $sort['order'];
        foreach ($order as $id) {
            if (isset($unordered[$id])) {
                $ordered[] = $unordered[$id];
            }
        }

        return $ordered;
    }
1209560
public function navigation() {
		$output = null;

		if ( $this->child_count() > 1 ) {

			$output .= '<ul class="uix-' . esc_attr( $this->type ) . '-tabs uix-panel-tabs">';
			$active = 'true';
			foreach ( $this->child as $child ) {
				if ( $this->is_section_object( $child ) ) {
					$output .= $this->tab_label( $child, $active );
					$active = 'false';
				}
			}
			$output .= '</ul>';
		}

		return $output;
	}
326404
public function getEntitiesNavBar()
    {
        $result = [];
        foreach ($this->datas as $entity => $data) {
            $navBarGroup = $data->getDefinition()->getNavBarGroup();
            if ($navBarGroup !== 'main') {
                $result[$navBarGroup][] = $entity;
            } else {
                $result[$entity] = 'main';
            }
        }
        return $result;
    }
385133
protected function renderNavigation()
    {
        $nav = array();
        if (!empty($this->wrapperOptions)) {
            $nav[] = \CHtml::openTag('div', $this->wrapperOptions);
        }
        $nav[] = \CHtml::openTag('nav', $this->htmlOptions);
        $nav[] = $this->renderTitle();
        $nav[] = $this->renderItems();
        $nav[] = \CHtml::closeTag('nav');

        if (!empty($this->wrapperOptions)) {
            $nav[] = \CHtml::closeTag('div');
        }
        return implode("\n", $nav);
    }
1316667
public function getParentPageOrRoot()
    {
        $page = $this->getPageOrRoot();
        if ($page->parent) {
            return $page->parent->getPageOrRoot();
        }
        return $page;
    }
981757
public function render()
    {
        parent::render();
        $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;

        return "list_user.tpl";
    }