2024-02-04 20:31:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2024-02-23 18:36:02 +00:00
|
|
|
use App\Services\SongStorages\DropboxStorage;
|
|
|
|
use App\Services\SongStorages\LocalStorage;
|
|
|
|
use App\Services\SongStorages\S3CompatibleStorage;
|
2024-04-26 13:35:26 +00:00
|
|
|
use App\Services\SongStorages\SftpStorage;
|
2024-02-23 18:36:02 +00:00
|
|
|
use App\Services\SongStorages\SongStorage;
|
2024-02-04 20:31:01 +00:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
|
|
|
class SongStorageServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
public function register(): void
|
|
|
|
{
|
|
|
|
$this->app->bind(SongStorage::class, function () {
|
|
|
|
$concrete = match (config('koel.storage_driver')) {
|
|
|
|
's3' => S3CompatibleStorage::class,
|
2024-02-05 11:50:06 +00:00
|
|
|
'dropbox' => DropboxStorage::class,
|
2024-04-26 13:35:26 +00:00
|
|
|
'sftp' => SftpStorage::class,
|
2024-02-04 20:31:01 +00:00
|
|
|
default => LocalStorage::class,
|
|
|
|
};
|
|
|
|
|
|
|
|
return $this->app->make($concrete);
|
|
|
|
});
|
|
|
|
|
|
|
|
$this->app->when(S3CompatibleStorage::class)
|
|
|
|
->needs('$bucket')
|
|
|
|
->giveConfig('filesystems.disks.s3.bucket');
|
2024-02-05 11:50:06 +00:00
|
|
|
|
|
|
|
$this->app->when(DropboxStorage::class)
|
2024-02-05 21:17:41 +00:00
|
|
|
->needs('$config')
|
|
|
|
->giveConfig('filesystems.disks.dropbox');
|
2024-02-04 20:31:01 +00:00
|
|
|
}
|
|
|
|
}
|