dimanche 27 septembre 2020

How to fetch files on bases of created_at in laravel?

I have multiple files in folders and I am getting files to merge them . Now I want them to fetch these files in ascending order on the base of created date? Which file is created first should come in loop iteration first.

 $bulk_pdf = public_path('bulk-pdf-consignment/manifest' . $this->manifest_id . '_.pdf');
 $allFilesPath = public_path('bulk-pdf-consignment/manifest_' . $this->manifest_id);
 $filesInFolder = File::files($allFilesPath);
 foreach ($filesInFolder as $path) {
                $file = pathinfo($path);
                $finalPath = $file['dirname'] . '/' . $file['basename'];
                $pdfMerger->addPDF($finalPath, 'all');
              
            }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire