-
-
Notifications
You must be signed in to change notification settings - Fork 834
/
SettingsServiceProvider.php
52 lines (45 loc) · 1.58 KB
/
SettingsServiceProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Settings;
use Flarum\Api\Controller\DeleteFaviconController;
use Flarum\Api\Controller\DeleteLogoController;
use Flarum\Api\Controller\UploadFaviconController;
use Flarum\Api\Controller\UploadLogoController;
use Flarum\Foundation\AbstractServiceProvider;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Filesystem\Factory;
use Illuminate\Database\ConnectionInterface;
use League\Flysystem\FilesystemInterface;
class SettingsServiceProvider extends AbstractServiceProvider
{
/**
* {@inheritdoc}
*/
public function register()
{
$this->container->singleton(SettingsRepositoryInterface::class, function () {
return new MemoryCacheSettingsRepository(
new DatabaseSettingsRepository(
$this->container->make(ConnectionInterface::class)
)
);
});
$this->container->alias(SettingsRepositoryInterface::class, 'flarum.settings');
$assets = function (Container $container) {
return $container->make(Factory::class)->disk('flarum-assets')->getDriver();
};
$this->container->when([
DeleteFaviconController::class,
DeleteLogoController::class,
UploadFaviconController::class,
UploadLogoController::class,
])
->needs(FilesystemInterface::class)
->give($assets);
}
}