Segregate your S3 content according to your environment. Adding the following to config/filesystems.php
1
'pdfs'=>[
2
'driver'=>'s3',
3
'root'=>env('APP_NAME').'/pdfs',
4
'key'=>env('AWS_ACCESS_KEY_ID'),
5
'secret'=>env('AWS_SECRET_ACCESS_KEY'),
6
'region'=>env('AWS_DEFAULT_REGION'),
7
'bucket'=>'mybucket',
8
'visibility'=>'public',
9
​
10
],
Copied!
In the above, PDF files will be stored for public consumption within a disk prefixed with the environment name. The key to this is the root attribute. This provides a path to prefix to all files that are created in the pdfs disk.
Write files to the pdf folder after specifying the disk;
1
Storage::disk('pdfs')->put('hello.txt','hello');
Copied!
The ->url() command can be used to get the public url for the created file;