1
I am generating a PDF dynamically with the DOMPDF
in the Laravel and I have to save the document in the service Cloud of Amazon.
I’m not able to save the document in the cloud. But I can only save locally.
$pdf = PDF::loadView('contract.contract-pdf', $data);
$pdf->save('contract.pdf');
$s3 = \Storage::disk('s3');
$s3->put('pdf/contract', new File('contract.pdf'), 'public');
How to send it to cloud?
Amigo.. gave any error message? Is there an error in the log of Laravel? I believe this is a case for use of TDD. Write a unit test, or integration test. Test any shipment to Amazon, and see if the credentials you are using have the correct permissions. Or use the Tinker of the Standard. Ex.:
php artisan tinker >> \Storage::disk('s3')->put('teste.txt', 'hello')
. Then see if there is an "test.txt" file in your Bucket or if an error message appears. I think your problem is with setting permission on AWS.– Paulo Sakamoto
Solution. Using the output() function of Dompdf to send the data.
– user67223