1 | <?php namespace Arcanesoft\Media; |
||
11 | class MediaServiceProvider extends PackageServiceProvider |
||
12 | { |
||
13 | /* ----------------------------------------------------------------- |
||
14 | | Properties |
||
15 | | ----------------------------------------------------------------- |
||
16 | */ |
||
17 | |||
18 | /** |
||
19 | * Package name. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $package = 'media'; |
||
24 | |||
25 | /* ----------------------------------------------------------------- |
||
26 | | Main Functions |
||
27 | | ----------------------------------------------------------------- |
||
28 | */ |
||
29 | |||
30 | /** |
||
31 | * Register the service provider. |
||
32 | */ |
||
33 | 80 | public function register() |
|
34 | { |
||
35 | 80 | parent::register(); |
|
36 | |||
37 | 80 | $this->registerConfig(); |
|
38 | 80 | $this->registerSidebarItems(); |
|
39 | 80 | $this->registerProviders([ |
|
40 | 80 | Providers\AuthorizationServiceProvider::class, |
|
41 | Providers\RouteServiceProvider::class, |
||
42 | ]); |
||
43 | 80 | $this->registerConsoleServiceProvider(Providers\ConsoleServiceProvider::class); |
|
44 | |||
45 | 80 | $this->syncFilesystemConfig(); |
|
46 | 80 | $this->registerMediaManager(); |
|
47 | 80 | } |
|
48 | |||
49 | /** |
||
50 | * Boot the service provider. |
||
51 | */ |
||
52 | 80 | public function boot() |
|
63 | |||
64 | /** |
||
65 | * Get the services provided by the provider. |
||
66 | * |
||
67 | * @return array |
||
68 | */ |
||
69 | 2 | public function provides() |
|
70 | { |
||
71 | return [ |
||
72 | 2 | Contracts\Media::class, |
|
73 | ]; |
||
74 | } |
||
75 | |||
76 | /* ----------------------------------------------------------------- |
||
77 | | Other Methods |
||
78 | | ----------------------------------------------------------------- |
||
79 | */ |
||
80 | |||
81 | /** |
||
82 | * Sync the filesystem config. |
||
83 | */ |
||
84 | 80 | private function syncFilesystemConfig() |
|
85 | { |
||
86 | 80 | foreach ($this->config()->get('arcanesoft.media.filesystem.disks', []) as $disk => $config) { |
|
87 | 80 | $this->config()->set("filesystems.disks.$disk", $config); |
|
88 | } |
||
89 | 80 | } |
|
90 | |||
91 | /** |
||
92 | * Register the media manager. |
||
93 | */ |
||
94 | 80 | private function registerMediaManager() |
|
98 | |||
99 | /** |
||
100 | * Publish the assets. |
||
101 | */ |
||
102 | 80 | protected function publishAssets() |
|
108 | } |
||
109 |