Get filter by date, using the table date as the options
Table has a report_week, which is the same for several records, the day the report ran.
I can get a list of distinct values for the options but I cannot see how to adjust the query with that data.
This gives me a set of report weeks to select.
How do I use this in the $query?
Solution:Jump to solution
Good guess.... ```SelectFilter::make('report_week')
->options(LeadGeneration::where('report_week', '!=', null)
->orderBy('report_week', $direction)
->distinct('report_week')
->pluck('report_week', 'report_week') )...
9 Replies
I think you should be able to accept
$data
as a param:
->query($query, $data) =>
Yes you are correct, I must be dealing with the timezone or something. the following code 'Selects' correctly but the query never effects the list.
The table view always returns all values in the table.
Is the
->query()
callback called at all?Yes, put in a logger
the if is not firing ,
So what's
$data
?
Shouldn't this be a single value?Actually the $data returns in $data['value]. a 0 or a 1 rather than the string
I guess because you didn't provide a key for pluck :
>pluck('report_week', 'report_week')
Solution
Good guess....
Works like it should!