disk('flarum-uploads', function (Paths $paths, UrlGenerator $url) { * return [ * 'root' => "$paths->public/assets/uploads", * 'url' => $url->to('forum')->path('assets/uploads') * ]; * }); * ``` * * @see https://laravel.com/docs/8.x/filesystem#configuration */ public function disk(string $name, $callback) { $this->disks[$name] = $callback; return $this; } /** * Register a new filesystem driver. * Drivers must implement `\Flarum\Filesystem\DriverInterface`. * * @param string $name: The name of the driver * @param string $driverClass: The ::class attribute of the driver. */ public function driver(string $name, string $driverClass) { $this->drivers[$name] = $driverClass; return $this; } public function extend(Container $container, Extension $extension = null) { $container->extend('flarum.filesystem.disks', function ($existingDisks) use ($container) { foreach ($this->disks as $name => $disk) { $existingDisks[$name] = ContainerUtil::wrapCallback($disk, $container); } return $existingDisks; }); $container->extend('flarum.filesystem.drivers', function ($existingDrivers) { return array_merge($existingDrivers, $this->drivers); }); } }