Here's a little code to point you in the right direction:
$pdfmerge = PDFMerger::init();
$pdfmerge->addPDF(public_path('invoices/transport/INV'.$towinvoice->id.'-'.$towunit->claim_number.'.pdf'));
// Get the uploaded images to merge with the PDF
if(isset($uploadedImages)){
foreach($uploadedImages as $image){
$pdfmerge->addPDF($image->getPath()); // Add each file for merging / can be pdf files
}
}
// Merge the files
$pdfmerge->merge();
// Save the file
$pdfmerge->save(public_path('invoices/transport/merged/INV'.$towinvoice->id.'-'.$towunit->claim_number.'.pdf'), 'file');
@ravp I wrote the code. Use the dompdf to create the other PDF files and then use merger to merge them. $pdfMerge->save() method will generate the pdf file.
Read the docs on the two packages you're using, if you get stuck, post what you've come up with and someone will be able to help you.
You have to give it a try on your own and let us see some progress here.
I for real still can't see where the issue is, @ravp please read the full comments, they pointing towards what you need, there's no exact code to write for you, you need to do it on your own.
Generate PDFs.
Save them to an empty tmp directory (so you don't have to worry about the names later on).
Loop this directory and everytime append the path you're getting using the finder - symfony component I mentioned above.
Simply execute the merge() and save() as the docs stated
Clear the tmp directory so it's ready for the next operation