Created
December 9, 2019 21:48
-
-
Save bredmor/5ed17622e8dd780c497eb046ffdeea4a to your computer and use it in GitHub Desktop.
s3 presigned uri request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get presigned url to access xml file directly on s3. | |
*/ | |
public function getXmlUrlAttribute() | |
{ | |
$client = Storage::disk('s3')->getAdapter()->getClient(); | |
$command = $client->getCommand('GetObject', [ | |
'Bucket' => config('filesystems.disks.s3.bucket'), | |
'Key' => $this->xml_path, | |
]); | |
return (string) $client | |
->createPresignedRequest($command, '+7 days') | |
->getUri(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment