Commit 9d8cdf71 authored by Nicolas Widart's avatar Nicolas Widart

Get the roots only for the given menu id

parent 3bb7d888
......@@ -65,7 +65,7 @@ class MenuController extends AdminBaseController
public function edit(Menu $menu)
{
$menuItems = $this->menuItem->roots();
$menuItems = $this->menuItem->rootsForMenu($menu->id);
$menuStructure = $this->menuRenderer->renderForMenu($menu->id, $menuItems);
......
......@@ -20,9 +20,9 @@ class EloquentMenuItemRepository extends EloquentBaseRepository implements MenuI
return $menuItem;
}
public function roots()
public function rootsForMenu($menuId)
{
return $this->model->roots()->orderBy('position')->get();
return $this->model->roots()->where('menu_id', $menuId)->orderBy('position')->get();
}
/**
......
......@@ -8,7 +8,7 @@ interface MenuItemRepository extends BaseRepository
* Get all root elements
* @return mixed
*/
public function roots();
public function rootsForMenu($menuId);
/**
* Get the menu items ready for routes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment