Skip to content

Commit 93c8035

Browse files
Add documentation
1 parent 7ec2279 commit 93c8035

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff 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">

src/SelectTree.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)