You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the fields function is called by nova itself to form the index results the request object contains the active filters values. However if it is called from the DownloadExcel action, they are empty.
I think this could be considered a bug. Or at least I would say it should be possible to access the filter values from within the fields function
Is there at least a quick workaround to get the filter values?
public function calculate(NovaRequest $request)
{
$model = PaymentSystem::make();
if ($request->has('filters')) {
// Get the decoded list of filters
$filters = json_decode(base64_decode($request->filters));
foreach ($filters as $filter) {
if (empty($filter->value)) {
continue;
}
// Create a new instance of the filter and apply the query to your model
$model = (new $filter->class)->apply($request, $model, $filter->value);
Consider the following nova lense:
If the
fields
function is called by nova itself to form the index results the request object contains the active filters values. However if it is called from theDownloadExcel
action, they are empty.I think this could be considered a bug. Or at least I would say it should be possible to access the filter values from within the fields function
Is there at least a quick workaround to get the filter values?
Please also see laravel/nova-issues#2405
The text was updated successfully, but these errors were encountered: