Skip to content

Commit

Permalink
Merge pull request #25 from CodeWithDennis/23-nullvalue
Browse files Browse the repository at this point in the history
Fixed an issue where tree would go into inf loop
  • Loading branch information
CodeWithDennis authored Sep 26, 2023
2 parents eb9424b + c85ad1b commit a7c6223
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/SelectTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ protected function setUp(): void
private function buildTree($parent = null): array|Collection
{
// Assign the parent's null value to the $parent variable if it's not null
$parent = $this->getParentNullValue() ?? $parent;
if ($parent == null || $parent == $this->getParentNullValue()) {
$parent = $this->getParentNullValue() ?? $parent;
}

// Create a default query to retrieve related items.
$defaultQuery = $this->getRelationship()
Expand Down

0 comments on commit a7c6223

Please sign in to comment.