From 0c2180a5dc7ff121e3990bb41177ced2388f7254 Mon Sep 17 00:00:00 2001 From: anil kumar thakur Date: Thu, 29 Feb 2024 01:33:07 +0545 Subject: [PATCH] update --- src/Traits/ExportDefaultMethods.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Traits/ExportDefaultMethods.php b/src/Traits/ExportDefaultMethods.php index 7e60747..c973d36 100644 --- a/src/Traits/ExportDefaultMethods.php +++ b/src/Traits/ExportDefaultMethods.php @@ -5,6 +5,7 @@ use Anil\FileExport\Service\CommonExport; use Illuminate\Filesystem\AwsS3V3Adapter; use Illuminate\Http\JsonResponse; +use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; @@ -18,11 +19,13 @@ private function finalExport(string $exportName, $exportClass): JsonResponse { $path = 'export/'.$exportName; $export = Excel::store($exportClass, $path, Config::get('fileExport.disk')); + $expiry = Carbon::today()->addDays(Config::get('fileExport.expireTime')); + if ($export) { $disk = Storage::disk(Config::get('fileExport.disk')); if ($disk instanceof AwsS3V3Adapter) { - $url = Storage::cloud()->temporaryUrl($path, Config::get('fileExport.expireTime')); + $url = Storage::cloud()->temporaryUrl($path, $expiry); } else { $url = Storage::disk(Config::get('fileExport.disk'))->url($path); }