/**
  * @param Navigation $nav
  * @param bool $asArray
  * @return array
  */
 protected function getChildren(Navigation $nav, $asArray = false)
 {
     $navs = Navigation::where('parent_id', '=', $nav->id)->orderBy('sort_order', 'ASC')->get();
     $result = [];
     foreach ($navs as $n) {
         if ($asArray) {
             $_n = $n->toArray();
             $_n['name'] = $n->name;
             $result[] = ['item' => $_n, 'children' => $this->getChildren($n, $asArray)];
         } else {
             $result[] = ['item' => $n, 'children' => $this->getChildren($n, $asArray)];
         }
     }
     return $result;
 }
 public function compose(View $view)
 {
     $navItems = Navigation::all();
     $view->with('items', $navItems);
 }