We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7c0d765 commit 7c1be94Copy full SHA for 7c1be94
1 file changed
src/SelectTree.php
@@ -550,15 +550,11 @@ public function getTreeUsing(Closure|array $value): static
550
return $this;
551
}
552
553
- public function getTree(): Collection|array
+ public function getTree(): Collection
554
{
555
- if ($this->getTreeUsing) {
556
- return $this->evaluate($this->getTreeUsing);
557
- }
558
-
559
- return $this->evaluate($this->buildTree()
+ return Collection::wrap($this->evaluate($this->getTreeUsing)) ?? $this->buildTree()
560
->when($this->prepend, fn (Collection $tree) => $tree->prepend($this->evaluate($this->prepend)))
561
- ->when($this->append, fn (Collection $tree) => $tree->push($this->evaluate($this->append)))
+ ->when($this->append, fn (Collection $tree) => $tree->push($this->evaluate($this->append))
562
);
563
564
0 commit comments