Closed moisessepulveda closed 2 years ago
At the moment there's no reliable way to identify resourceIds
when Lens query doesn't use the resource default ID https://github.com/laravel/nova/blob/96d4481cfd5bd4406212487e17838fd6bc261f6e/src/Http/Requests/ActionRequest.php#L118-L121 and this wouldn't be an easy fix.
If you can accept to export CSV for "select all" until we can come up with a solution then you can use the following:
public function lenses(Request $request): array
{
return [
PaymentsPerEmployee::make()->canSee(function ($request) {
return $request->allResourcesSelected();
}),
];
}
Thanks for the answer, I hope you can find a solution soon. I'll stick with the workaround proposal for the moment
Description:
When you we have a lens that contains a group by and you try to export data as CSV, it doesn't work when you select individual record. It only works when "Select all" is selected.
This issue only happens when primary key obtained from query does not belongs to the same model as resource.
Detailed steps to reproduce the issue on a fresh Nova installation:
First keep in mind and create the next two models:
Employee:
Payment:
Consider a query like this:
fields:
actions: