F
Filament10mo ago
morty

What is the difference between these two options on a select filter?

I've seen this done both ways but unsure which to use?
SelectFilter::make('tags')
->options(
fn (): array => Tag::getWithType('crm.accounts')->pluck('name', 'name')->all()
)
SelectFilter::make('tags')
->options(
fn (): array => Tag::getWithType('crm.accounts')->pluck('name', 'name')->all()
)
vs
SelectFilter::make('tags')
->options(Tag::getWithType('crm.accounts')->pluck('name', 'name'))
SelectFilter::make('tags')
->options(Tag::getWithType('crm.accounts')->pluck('name', 'name'))
Solution:
🤷‍♂️ nothing you dont need ->all() at all all if you have some operations on the collection like filtering or additions etc...
Jump to solution
4 Replies
Solution
Lara Zeus
Lara Zeus10mo ago
🤷‍♂️ nothing you dont need ->all() at all all if you have some operations on the collection like filtering or additions etc
morty
mortyOP10mo ago
What about the closure vs no closure? Same thing?
Lara Zeus
Lara Zeus10mo ago
if you need to inject some dependencies use closure
morty
mortyOP10mo ago
Gotcha, thanks.
Want results from more Discord servers?
Add your server