Skip to content

Commit

Permalink
menu builder updates
Browse files Browse the repository at this point in the history
  • Loading branch information
indpurvesh committed Aug 9, 2019
1 parent df2ca92 commit 90624f6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Database/Repository/MenuGroupRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ public function getTreeByIdentifier(string $identifier) : SupportCollection
$menus = collect();
$menuGroup = MenuGroup::whereIdentifier($identifier)->first();


$modelMenus = $menuGroup->menus()->whereNull('parent_id')->get();
foreach ($modelMenus as $modelMenu) {
$modelMenu->submenus;
$menus->push($modelMenu);
if ($menuGroup !== null) {
$modelMenus = $menuGroup->menus()->whereNull('parent_id')->get();
foreach ($modelMenus as $modelMenu) {
$modelMenu->submenus;
$menus->push($modelMenu);
}
}

return $menus;
Expand Down

0 comments on commit 90624f6

Please sign in to comment.