@@ -23,7 +23,7 @@ class SelectTree extends Field
2323
2424 protected bool $ alwaysOpen = false ;
2525
26- protected string $ emptyLabel ;
26+ protected string $ emptyLabel = '' ;
2727
2828 protected bool $ independent = true ;
2929
@@ -167,7 +167,7 @@ public function getDisabledBranchNode(): bool
167167
168168 public function getEmptyLabel (): string
169169 {
170- return $ this ->evaluate ($ this ->emptyLabel );
170+ return ! $ this -> emptyLabel ? __ ( ' No results found ' ) : $ this ->evaluate ($ this ->emptyLabel );
171171 }
172172
173173 public function tree (string $ treeModel , string $ treeParentKey , string $ titleAttribute , Closure $ modifyQueryUsing = null ): static
@@ -188,7 +188,7 @@ private function buildTree(int $parent = null): array|Collection
188188 }
189189
190190 // Check if the treeModel is not set; if yes, return an empty collection.
191- if (! $ this ->treeModel ) {
191+ if (!$ this ->treeModel ) {
192192 return collect ();
193193 }
194194
@@ -197,7 +197,7 @@ private function buildTree(int $parent = null): array|Collection
197197 ->where ($ this ->treeParentKey , $ parent );
198198
199199 // If we're not at the root level and a modification callback is provided, apply it.
200- if (! $ parent && $ this ->modifyQueryUsing ) {
200+ if (!$ parent && $ this ->modifyQueryUsing ) {
201201 $ defaultQuery = $ this ->evaluate ($ this ->modifyQueryUsing , ['query ' => $ defaultQuery ]);
202202 }
203203
0 commit comments