Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
anilkumarthakur60 committed Feb 28, 2024
1 parent f8cbe73 commit 0c2180a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Traits/ExportDefaultMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down

0 comments on commit 0c2180a

Please sign in to comment.