store($filePathForS3, 's3'); //Step 2: Return temporary URL from S3 $temporaryUrl = Storage::disk('s3')->temporaryUrl( $filePathForS3, Carbon::now()->addMinutes(10) ); return $temporaryUrl; } /** * @param string $exportFileName * @param string|resource $contents * @return string */ static function S3PDF($exportFileName, $contents){ //Step 1: Upload to S3 $filePathForS3 = 'temp/' . $exportFileName; Storage::disk('s3')->put($filePathForS3, $contents); //Step 2: Return temporary URL from S3 $temporaryUrl = Storage::disk('s3')->temporaryUrl( $filePathForS3, Carbon::now()->addMinutes(10) ); return $temporaryUrl; } }