Custom Filter and Query Scope
Hi everyone, I'm facing some difficulties understanding how Filament behaves behind the scenes regarding custom filters and queries. To elaborate further: I have a resource displaying a table linked to a Laravel model. However, the table is extremely large (with several million records), and I've applied a basic scope to filter the query.
MyScope:
I take the latest record, read the value of a column (lunivid_serie) , and filter the entire query for the found value:
The issue arises when, through a custom filter, I try to provide the ability to modify this filter. I'm attempting to access the $query variable using the withoutGlobalScopes() method, but the query fails without an apparent reason (the records exist and are present; when I do dd($query), everything seems to be correctly set up).
This filter is NOT working...
Can anyone explain to me how to have a general filter ONLY on the table and a dynamically custom filter based on the filter, so that the querydoesn't start with the same filter set to initially display the data in the table? It seems like an extremely straightforward operation, and it's surprising that there isn't a clear and precise way to achieve this result. Thanks to everyone.
1 Reply
This filter is NOT working...
Currently, this allows me to see the correct data for the latest 'series' when loading the table. However, as soon as I apply the filter, I don't receive any results. (The queries for the select dropdown options work correctly).
The dd() inside the ->when() method, i can't see nothing wrong here(?):
Anyone? 😦
Pump! 🙂
Anyone? Please 🙂