@jonassiewertsen refer https://laracasts.com/discuss/channels/nova/nova-action-export-resource-to-a-customized-pdf
You can use Action::redirect() to redirect to another route where you export PDF actually.
May 11, 2019
7
Level 14
Download PDF in Laravel Nova Action
I want do generate a pdf in Laravel Nova and download theme. I can't get it working
The code is in an Laravel Nova Action (php artisan nova:action)
public function handle(ActionFields $fields, Collection $models)
{
$pdf = PDF::loadView('pdf.test');
// This is saving the pdf. So the $pdf->download does work
// Storage::put('/pdfs/testsave.pdf', $pdf->download('save.pdf'));
// NOT Working in the Nova Action
// return $pdf->download
// NOVA says to do something like this.
return Action::download('url_here', 'file_name.pdf');
}
Maybe i could save the pdf on the server, pass the path and delete it again?
Any ideas how to get it to work?
In the best possible, i don not need to save the pdf on my server.
Regards, Jonas
Level 2
Please or to participate in this conversation.