fix: register minio custom driver using flysystem-aws-s3-v3 (Laravel 5.0 hardcodes v2)
All checks were successful
Deploy Production (crewsportswear.com) / deploy (push) Successful in 2m5s
All checks were successful
Deploy Production (crewsportswear.com) / deploy (push) Successful in 2m5s
This commit is contained in:
@@ -4,6 +4,8 @@ use Illuminate\Support\ServiceProvider;
|
||||
use Storage;
|
||||
use League\Flysystem\Filesystem;
|
||||
use League\Flysystem\Sftp\SftpAdapter;
|
||||
use League\Flysystem\AwsS3v3\AwsS3Adapter as AwsS3v3Adapter;
|
||||
use Aws\S3\S3Client;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider {
|
||||
|
||||
@@ -27,6 +29,21 @@ class AppServiceProvider extends ServiceProvider {
|
||||
Storage::extend('sftp', function ($app, $config) {
|
||||
return new Filesystem(new SftpAdapter($config));
|
||||
});
|
||||
|
||||
Storage::extend('minio', function ($app, $config) {
|
||||
$client = new S3Client([
|
||||
'credentials' => [
|
||||
'key' => $config['key'],
|
||||
'secret' => $config['secret'],
|
||||
],
|
||||
'region' => $config['region'],
|
||||
'version' => 'latest',
|
||||
'endpoint' => $config['endpoint'],
|
||||
'use_path_style_endpoint' => filter_var($config['use_path_style_endpoint'] ?? true, FILTER_VALIDATE_BOOLEAN),
|
||||
]);
|
||||
$adapter = new AwsS3v3Adapter($client, $config['bucket']);
|
||||
return new Filesystem($adapter);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user