Hello, I need to have an action in all resources to export to pdf the selected and/or filtered records of the resource. I am trying to use:
https://novapackages.com/packages/padocia/laravel-nova-pdf
I have installed following directions and keep receiving an error:
Too few arguments to function Laravel\Nova\Actions\Action::fields(), 0 passed in c:\laravel\nova\vendor\eparment\nova-dependency-container\src\Http\ActionRequest.php on line 21 abd exactly 1 expected.
It is not really an invoice (though I am keeping the name of the example). I need to export records shown and selected by the user.
My InvoiceAction.php inside Nova\Actions
class InvoiceAction extends ExportToPdf
{
/**
* @param \Laravel\Nova\Fields\ActionFields $fields
* @param \Illuminate\Support\Collection $models
*
* @return \Illuminate\View\View
*/
public function preview(ActionFields $fields, Collection $models) : View
{
$resource = $this->resource;
return view('nova-pdf.template', compact($models,$resource));
}
}
My actions part of code inside the Tienda.php resource inside Nova (Tienda is my first example of many)
public function actions(NovaRequest $request)
{
return [
new InvoiceAction,
];
}
Any ideas or help, please?
Thank you