diff --git a/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadCustomerInvoicesLogic.php b/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadCustomerInvoicesLogic.php index c409922f..06640779 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadCustomerInvoicesLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadCustomerInvoicesLogic.php @@ -70,14 +70,15 @@ class BulkDownloadCustomerInvoicesLogic if ($zip->open($zip_file, ZipArchive::CREATE | ZipArchive::OVERWRITE)) { foreach ($invoicebookings as $booking) { $invoice_file = $booking->documents()->where('document_type', DocumentType::INVOICE)->whereNull('deleted_at')->first()->files()->first(); - $zip->addFile(Storage::disk('s3')->get('documents/'.$invoice_file->file->file_info->original->file), 'invoice-' . $booking->created_at->format('d_m_Y') . '_' . $booking->marking . '.pdf'); + $fileContent = Storage::disk('s3')->get('documents/'.$invoice_file->file->file_info->original->file); + $zip->addFromString('invoice-' . $booking->created_at->format('d_m_Y') . '_' . $booking->marking . '.pdf', $fileContent); } $zip->close(); $filePath = 'bulk_invoice/'.$zipFileName; Storage::put($filePath, file_get_contents($zip_file), 's3'); - return response(['src' => Storage::disk('s3')->get($$filePath) ]); + return response(['src' => Storage::disk('s3')->get($filePath) ]); } else { return response()->json([