SelectFilter unique/distinct relationship value
I have a table of tickets that belong to a location. Some locations are in the same city. How can I use a SelectFilter to get a unique list of cities from the locations table to filter the tickets? This is my code so far:
But this gives me a list of duplicated cities. I tried something like the following but unsuccessfully:
Not sure how to achieve this?
4 Replies
bump
b2
You will want to get the primary country select? then get the cities where the country is?
Here is an example:
https://v2.filamentphp.com/tricks/dependent-select-filters
Filament
Dependent Select Filters by Hugh Messenger - Tricks - Filament
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
No sorry I'll clarify. My location table (simplified) looks like this:
Using the filter code in the OP, It would list New York 3 times, Chicago 2 times, etc. I just want the filter to list the unique cities, and if I filter New York, it shows the 3 locations in the table. Thinking more about this, it doesn't seem like I should use the
relationship
but instead just do a custom select filter. Would that be your take as well?
Something like this maybe?