Skip to content

Commit

Permalink
Set children to a null value to avoid the need to check its existence
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x committed Jul 4, 2019
1 parent dd39bb3 commit 9f224e7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Navi.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ protected function tree($items, $parent = 0, $branch = [])
if ($item->parent == $parent) {
$children = $this->tree($items, $item->id);

$item->children = [];

if (! empty($children)) {
$item->children = $children;
}
Expand Down

0 comments on commit 9f224e7

Please sign in to comment.