app->singleton(FileDiskService::class); $this->app->bind( StorageConfigurator::class, fn (Application $app): FileDiskService => $app->make(FileDiskService::class), ); } /** * Bootstrap services. */ public function boot(): void { Gate::define('manage backups', [StorageAccessPolicy::class, 'manage']); Gate::define('manage file disk', [StorageAccessPolicy::class, 'manage']); $this->commands([ MigrateMediaToPrivateDisk::class, ]); Storage::extend('dropbox', function ($app, $config) { $client = new DropboxClient( $config['token'] ); $root = trim($config['root'] ?? '', '/'); $adapter = new DropboxAdapter($client, $root); $flysystem = new Filesystem($adapter); return new FilesystemAdapter($flysystem, $adapter, $config); }); } }