I am using Lavary's laravel-menu package, and I am trying to build a simple 2 level menu system based on the contents of a db table. I have the middleware created to create the menu on each request:

public function handle($request, Closure $next) { Menu::make('NavBar', function($menu){ $menuitems = MenuItem::all(); foreach($menuitems as $menuitem) { if(!is_null($menuitem->parent)){ // For example, 'Conferences', a top level menu item with a null parent field $menu->add($menuitem->title, url($menuitem->url)); } else{ // Parent is a field in database, for example 'Traverse City 2015' would have the parent 'conferences' $parent = $menuitem->parent; $menu->item($parent)->add($menuitem->title, url($menuitem->url)); } } }); return $next($request); }

In my view, I call:

{!! $NavBar->asUl() !!}

I would expect this to render as such:

<ul> <li><a href="/conferences">Conferences</a></li> <ul> <li><a href="/conferences/traverse-city-2015">Traverse City 2015</li> </ul> </ul>

Instead, it is rendering:

<ul> <li><a href="/conferences/">Conferences</a></li> <li><a href="/conferences/traverse-city-2015">Traverse City 2015</a></li> </ul>

Any ideas why the sub-items aren't showing up correctly?