Skip to content

Commit b66558e

Browse files
authored
Created docs to explain additional switch option
This remove the work-around of creating two arrays and merging them to get the evalues. followed by the reslts Buiilder/Qiery
1 parent f9c1ab8 commit b66558e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

docs/filters/creating-filters.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,15 @@ public function filters(): array
6161
25 => 'Type Y',
6262
26 => 'Type Z',
6363
],
64-
]),
64+
])
65+
->setFirstOption('All Tags'),
6566
];
6667
}
6768
```
69+
To set a defualt "All" option at the start of the dropdown, you can do so by utilising the
70+
```
71+
->SetFirstOption('NAME')
72+
```
6873

6974
## Multi-select Filters
7075

@@ -91,23 +96,24 @@ public function filters(): array
9196

9297
## Multi-select dropdown Filters
9398

94-
Multi-select dropdown filters are a simple dropdown list. The user can select multiple options from the list. There is also an 'All' option that will select all values.
99+
Multi-select dropdown filters are a simple dropdown list. The user can select multiple options from the list. There is also an 'All' option that will select all values
95100

96101
```php
97-
use Rappasoft\LaravelLivewireTables\Views\Filters\MultiSelectDropdownFilter;
102+
use Rappasoft\LaravelLivewireTables\Views\Filters\SelectFilter;
98103

99104
public function filters(): array
100105
{
101106
return [
102-
MultiSelectDropdownFilter::make('Tags')
107+
SelectFilter::make('Tags')
103108
->options(
104109
Tag::query()
105110
->orderBy('name')
106111
->get()
107112
->keyBy('id')
108113
->map(fn($tag) => $tag->name)
109114
->toArray()
110-
),
115+
)
116+
->setFirstOption('All Tags'),
111117
];
112118
}
113119
```

0 commit comments

Comments
 (0)