addDefinitions([ FilesystemOperator::class => \DI\get(Filesystem::class), Filesystem::class => function (ConfigInterface $config) { $default = $config->get('storage.default', 'local'); $diskConfig = $config->get("storage.disks.$default"); if (!$diskConfig) { throw new \RuntimeException("Storage disk [$default] is not configured."); } $driver = $diskConfig['driver'] ?? 'local'; if ($driver !== 'local') { throw new \RuntimeException("Unsupported storage driver [$driver]. Only 'local' is supported currently."); } $root = $diskConfig['root']; $adapter = new LocalFilesystemAdapter($root); return new Filesystem($adapter); }, ]); } public function boot(Container $container): void {} }