mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-29 17:34:02 +00:00
Merge branch 'dillon/34.4-jenkins-vapor' into vapor/development
This commit is contained in:
@@ -61,15 +61,22 @@ class ExportCustomersToExcelController
|
||||
$exportFileName = 'payment-transactions.xls';
|
||||
$filesystemDriver = Storage::getDefaultDriver();
|
||||
if($filesystemDriver === 's3'){
|
||||
$exportDirectory = storage_path('app/export'); // Update this with the actual directory path
|
||||
|
||||
//Step 1: Upload to S3
|
||||
$filePathForS3 = 'temp/' . $exportFileName;
|
||||
$exportsTransactions->store($filePathForS3, 's3');
|
||||
|
||||
//Step 2: Read and Download from S3
|
||||
$fileContent = Storage::disk('s3')->get($filePathForS3);
|
||||
$exportDirectory = storage_path('app/temp'); // Update this with the actual directory path
|
||||
if (!file_exists($exportDirectory)) {
|
||||
mkdir($exportDirectory, 0755, true);
|
||||
}
|
||||
// $localPath = $exportDirectory . '/' . $exportFileName;
|
||||
$response = $exportsTransactions->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
$localPath = $exportDirectory . '/' . $exportFileName;
|
||||
file_put_contents($localPath, $fileContent);
|
||||
|
||||
// file_put_contents($localPath, $response);
|
||||
return response()->file($response->getFile()->getPathname(), ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
//Step 3: Return
|
||||
return response()->file($localPath, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
}
|
||||
else{
|
||||
$response = $exportsTransactions->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
|
||||
Reference in New Issue
Block a user