Column not found with table filter and joins
Hello everyone,
I am working on my first project with filament and I have hit a brick wall.
I'm trying to use SelectFilter with a query that has a join in it, but I can't seem to get it to work.
So transactions table can have multple transactions by a person, which are payments for years. I want to create a filter dropdown that will enable to find everyone who hasn't paid for the selected year. The error I keep getting is:
When I open the base page without any filters applied it works fine. I also tried getting and running the query generated by this code and it works fine, I can run it on the DB directly without any issues. The generated SQL from the Select eloquent query looks like this:
However the error looks completely different and I suspect it has something to do with pagination, but I am not sure how to solve this. Pls help.
Solution:Jump to solution
joining non-distinct will break table functionality.
You can use the selected year from dropdown and instead of joining use the
whereHas
method to filter persons.
Something like this:
```php...2 Replies
Solution
joining non-distinct will break table functionality.
You can use the selected year from dropdown and instead of joining use the
whereHas
method to filter persons.
Something like this:
Thank you very much for the reply and the clarification!
I just needed to replace whereHas with whereDoesntHave in your code but works perfectly now 🎉