File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,22 @@ Activate the search functionality
156156->searchable();
157157```
158158
159+ Disable specific options in the tree
160+
161+ ``` PHP
162+ ->disabledOptions([2, 3, 4])
163+ ```
164+
165+ ``` PHP
166+ ->disabledOptions(function () {
167+ return Category::where('is_disabled', true)
168+ ->get()
169+ ->pluck('id')
170+ ->toArray();
171+ })
172+ ```
173+
174+
159175## Screenshots
160176
161177<img width =" 641 " alt =" light " src =" https://github.com/CodeWithDennis/filament-select-tree/assets/23448484/4d348c85-5ee9-45b1-9424-0d8b3efcc02e " >
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ class SelectTree extends Field
4949
5050 protected string $ direction = 'auto ' ;
5151
52- protected array $ disabledOptions = [];
52+ protected Closure | array $ disabledOptions = [];
5353
5454 protected function setUp (): void
5555 {
@@ -254,7 +254,7 @@ public function independent(bool $independent = true): static
254254 return $ this ;
255255 }
256256
257- public function disabledOptions (array $ disabledOptions = [] ): static
257+ public function disabledOptions (Closure | array $ disabledOptions ): static
258258 {
259259 $ this ->disabledOptions = $ disabledOptions ;
260260
You can’t perform that action at this time.
0 commit comments