We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5a1b15d + 3c5b2be commit db9ef2fCopy full SHA for db9ef2f
src/SelectTree.php
@@ -134,9 +134,13 @@ private function buildTree(): Collection
134
$nullParentQuery = $this->evaluate($this->modifyQueryUsing, ['query' => $nullParentQuery]);
135
}
136
137
- // Fetch results for both queries
138
- $nullParentResults = $nullParentQuery->withTrashed($this->withTrashed)->get();
139
- $nonNullParentResults = $nonNullParentQuery->withTrashed($this->withTrashed)->get();
+ if ($this->withTrashed) {
+ $nullParentQuery->withTrashed($this->withTrashed);
+ $nonNullParentQuery->withTrashed($this->withTrashed);
140
+ }
141
+
142
+ $nullParentResults = $nullParentQuery->get();
143
+ $nonNullParentResults = $nonNullParentQuery->get();
144
145
// Combine the results from both queries
146
$combinedResults = $nullParentResults->concat($nonNullParentResults);
0 commit comments