Wire up instantiation of Flysystem adapter for avatar storage.

This commit is contained in:
Franz Liedke 2015-03-25 14:26:38 +01:00
parent 100a5038bf
commit e4ed057557

View File

@ -12,6 +12,7 @@ use Flarum\Core\Models\User;
use Flarum\Core\Models\Discussion; use Flarum\Core\Models\Discussion;
use Flarum\Core\Models\Notification; use Flarum\Core\Models\Notification;
use Flarum\Core\Search\GambitManager; use Flarum\Core\Search\GambitManager;
use League\Flysystem\Adapter\Local;
class CoreServiceProvider extends ServiceProvider class CoreServiceProvider extends ServiceProvider
{ {
@ -83,6 +84,14 @@ class CoreServiceProvider extends ServiceProvider
'Flarum\Core\Repositories\NotificationRepositoryInterface', 'Flarum\Core\Repositories\NotificationRepositoryInterface',
'Flarum\Core\Repositories\EloquentNotificationRepository' 'Flarum\Core\Repositories\EloquentNotificationRepository'
); );
$this->app->singleton('flarum.avatars.storage', function () {
return new Local(__DIR__.'/../../ember/public/avatars');
});
$this->app->when('Flarum\Core\Handlers\Commands\UploadAvatarCommandHandler')
->needs('League\Flysystem\FilesystemInterface')
->give('flarum.avatars.storage');
} }
public function registerGambits() public function registerGambits()