lundi 28 septembre 2020

Laravel package not merfing second last file

I am using laravel package to merge files . it is working fine on localhost but on server it missed second last file to merge what could be the issue?

if ($this->last) {
            $pdfMerger = new  PdfMerger();

            $bulk_pdf = public_path('bulk-pdf-consignment/manifest' . $this->manifest_id . '_.pdf');
            $allFilesPath = public_path('bulk-pdf-consignment/manifest_' . $this->manifest_id);

            // if (File::exists($bulk_pdf)) {
            //     $pdfMerger->addPDF($bulk_pdf, 'all');
            // }
            $filesInFolder = collect(File::files($allFilesPath))->sortBy(function($file) {
                return $file->getCTime();
              });
         
           $arr = [];
            foreach ($filesInFolder as $path) {
                $file = pathinfo($path);
                $finalPath = $file['dirname'] . '/' . $file['basename'];

                $added =  $pdfMerger->addPDF($finalPath, 'all');
                // if ($added) {
                //     array_push($arr, $finalPath);
                // }
            }

            $merged =  $pdfMerger->merge("file", $bulk_pdf);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire