1
|
|
|
<?php namespace Arcanesoft\Media; |
2
|
|
|
|
3
|
|
|
use Arcanesoft\Core\Bases\PackageServiceProvider; |
4
|
|
|
use Arcanesoft\Core\CoreServiceProvider; |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* Class MediaServiceProvider |
8
|
|
|
* |
9
|
|
|
* @package Arcanesoft\Media |
10
|
|
|
* @author ARCANEDEV <[email protected]> |
11
|
|
|
*/ |
12
|
|
|
class MediaServiceProvider extends PackageServiceProvider |
13
|
|
|
{ |
14
|
|
|
/* ------------------------------------------------------------------------------------------------ |
15
|
|
|
| Properties |
16
|
|
|
| ------------------------------------------------------------------------------------------------ |
17
|
|
|
*/ |
18
|
|
|
/** |
19
|
|
|
* Package name. |
20
|
|
|
* |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
protected $package = 'media'; |
24
|
|
|
|
25
|
|
|
/* ------------------------------------------------------------------------------------------------ |
26
|
|
|
| Getters & Setters |
27
|
|
|
| ------------------------------------------------------------------------------------------------ |
28
|
|
|
*/ |
29
|
|
|
/** |
30
|
|
|
* Get the base path of the package. |
31
|
|
|
* |
32
|
|
|
* @return string |
33
|
|
|
*/ |
34
|
4 |
|
public function getBasePath() |
35
|
|
|
{ |
36
|
4 |
|
return dirname(__DIR__); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/* ------------------------------------------------------------------------------------------------ |
40
|
|
|
| Main Functions |
41
|
|
|
| ------------------------------------------------------------------------------------------------ |
42
|
|
|
*/ |
43
|
|
|
/** |
44
|
|
|
* Register the service provider. |
45
|
|
|
*/ |
46
|
4 |
|
public function register() |
47
|
|
|
{ |
48
|
4 |
|
$this->registerConfig(); |
49
|
4 |
|
$this->registerSidebarItems(); |
50
|
4 |
|
$this->app->register(CoreServiceProvider::class); |
51
|
4 |
|
$this->app->register(Providers\PackagesServiceProvider::class); |
52
|
4 |
|
$this->app->register(Providers\AuthorizationServiceProvider::class); |
53
|
|
|
|
54
|
4 |
|
if ($this->app->runningInConsole()) { |
55
|
4 |
|
$this->app->register(Providers\CommandServiceProvider::class); |
56
|
2 |
|
} |
57
|
|
|
|
58
|
4 |
|
$this->syncFilesystemConfig(); |
59
|
4 |
|
} |
60
|
|
|
|
61
|
4 |
|
private function syncFilesystemConfig() |
62
|
|
|
{ |
63
|
4 |
|
foreach ($this->config()->get('arcanesoft.media.filesystem.disks', []) as $disk => $config) { |
64
|
4 |
|
$this->config()->set("filesystems.disks.$disk", $config); |
65
|
2 |
|
} |
66
|
4 |
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Boot the service provider. |
70
|
|
|
*/ |
71
|
4 |
|
public function boot() |
72
|
|
|
{ |
73
|
4 |
|
$this->app->register(Providers\RouteServiceProvider::class); |
74
|
|
|
|
75
|
|
|
// Publishes |
76
|
4 |
|
$this->publishConfig(); |
77
|
4 |
|
$this->publishViews(); |
78
|
4 |
|
$this->publishTranslations(); |
79
|
4 |
|
$this->publishSidebarItems(); |
80
|
4 |
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Get the services provided by the provider. |
84
|
|
|
* |
85
|
|
|
* @return array |
86
|
|
|
*/ |
87
|
2 |
|
public function provides() |
88
|
|
|
{ |
89
|
|
|
return [ |
90
|
|
|
// |
91
|
2 |
|
]; |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|