public function hasChildren() { $totalChildren = Menu::where('parent_id', $this->id)->orderBy('order', 'ASC')->get()->count(); if ($totalChildren > 0) { return true; } return false; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $parentMenus = Menu::parents(); /*foreach($parentMenus as $menu){ _buildMenu( $menu->subMenus() ); } return;*/ return view('cms::menu.menus', compact('parentMenus')); }