From 38ad3d315d10584e6836f017c8e82a084d190b58 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Fri, 26 Apr 2024 18:34:09 +0800 Subject: [PATCH] Laravel Vapor - debug reading from S3 storage --- .../BulkDownloadCustomerInvoicesLogic.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadCustomerInvoicesLogic.php b/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadCustomerInvoicesLogic.php index b6279192..a02ff4e8 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadCustomerInvoicesLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadCustomerInvoicesLogic.php @@ -65,8 +65,8 @@ class BulkDownloadCustomerInvoicesLogic $zipFileName = "invoices_{$startDate}_to_{$endDate}_{$company->reference}.zip"; $zip_file = "{$zipDirectory}/{$zipFileName}"; - $zipFileName2 = "invoices_{$startDate}_to_{$endDate}_{$company->reference}_dup.zip"; - $zip_file2 = "{$zipDirectory}/{$zipFileName2}"; + // $zipFileName2 = "invoices_{$startDate}_to_{$endDate}_{$company->reference}_dup.zip"; + // $zip_file2 = "{$zipDirectory}/{$zipFileName2}"; $zip = new ZipArchive(); if ($zip->open($zip_file, ZipArchive::CREATE | ZipArchive::OVERWRITE)) { @@ -77,13 +77,13 @@ class BulkDownloadCustomerInvoicesLogic } $zip->close(); - $filePath = 'bulk_invoice/'.$zipFileName; - Storage::put($filePath, file_get_contents($zip_file), 's3'); + // $filePathForS3 = 'bulk_invoice/'.$zipFileName; + // Storage::put($filePathForS3, file_get_contents($zip_file), 's3'); + // $responseContent = Storage::disk('s3')->get($filePathForS3); + // file_put_contents($zip_file2, $responseContent); + // return response()->download($zip_file2); - $responseContent = Storage::disk('s3')->get($filePath); - file_put_contents($zip_file2, $responseContent); - - return response()->download($zip_file2); + return response()->download($zip_file); } else { return response()->json([ 'status' => 'Error',