I have a Laravel JSON API project where I upload a PDF file to storage. I get the form data from the front end.
Storage::cloud()->put($randompath . $request->file('given_pdf')
->getClientOriginalName(), file_get_contents($request->file('given_pdf')));
However, now I am using barryvdh/laravel-dompdf
package and I have to do something like that:
$pdf = PDF::loadView('documents.client_road_order_doc', ['data' => $data]);
$file = $pdf->download('client_order_doc.pdf')->getOriginalContent();
Storage::cloud()->put($randompath . "filename", $file);
I have to write different functions for this one, because $file
isn't same type as $request->file('given_pdf')
; I don't want to write a different function. My question is can I get from $pdf->download('client_order_doc.pdf')
the same type of object like $request->file('given_pdf')
?