Newbie question about reusing filters
Just under 10 hours using Fillament, so maybe obvious and I am missing it, but is there a common Filament way of reusing filters or this is just fine?
Basically creating a class and pulling it from there in any resource which uses that filter.
Solution:Jump to solution
You’re on the right track and this will probably work. But I would extend the Filter class itself instead on returning a filter instance. Then you can define the modifiers inside the setUp() method. And then you can just use it in your table as UpcomingFilter::make() without having to give it a name.
2 Replies
Solution
You’re on the right track and this will probably work. But I would extend the Filter class itself instead on returning a filter instance. Then you can define the modifiers inside the setUp() method. And then you can just use it in your table as UpcomingFilter::make() without having to give it a name.
Just for reference if someone is looking for it in the future, here is the refactored version of the above class which works fine too but is indeed more elegant.