From 577273bb240cb2f3bc3c97d81e23a0633b9c66b8 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Mon, 29 Apr 2024 11:47:19 +0800 Subject: [PATCH] Laravel Vapor - sync code for download files in bulk from S3 to more files --- .../BulkDownloadSupplierWhiteFormsLogic.php | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadSupplierWhiteFormsLogic.php b/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadSupplierWhiteFormsLogic.php index 4bdbaa8d..1f09e8dd 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadSupplierWhiteFormsLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadSupplierWhiteFormsLogic.php @@ -72,13 +72,19 @@ class BulkDownloadSupplierWhiteFormsLogic Log::info('BulkDownloadSupplierWhiteFormsLogic finished processing files count: '.count($groups)); - return response()->streamDownload(function () use ($filePathForS3) { - echo Storage::disk('s3')->temporaryUrl( - $filePathForS3, - Carbon::now()->addMinutes(60), - ['ResponseContentDisposition' => 'attachment'] - ); - }, $zipFileName); + // return response()->streamDownload(function () use ($filePathForS3) { + // echo Storage::disk('s3')->temporaryUrl( + // $filePathForS3, + // Carbon::now()->addMinutes(60), + // ['ResponseContentDisposition' => 'attachment'] + // ); + // }, $zipFileName); + + $tempUrl = Storage::disk('s3')->temporaryUrl( + $filePathForS3, + Carbon::now()->addMinutes(60) + ); + return response()->download($tempUrl); } else { return response()->json([