I have a situation where i need to build Rest APIs for the iOS and other apps using Laravel passport. And i also have a web app. this web app and API app located on different servers. They are sharing same database and hence i need to share storage as well. So i would like to upload files through API to the web apps storage folder.
I don't want to use any external storage service.
do i need to create some custom drive for this? something like -
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
How do i accomplish this? Need guidance.
Thanks.
You could create your own disk based on the local driver. For example, add the following to your disks
array in filesystems.php
.
'mystoragedisk' => [
'driver' => 'local',
'root' => '/path/to/storage/on/server',
]
You could then either change the default storage disk to your new one, or call the disk
method when storing or retrieving files.