1
|
|
|
<?php namespace Anomaly\SettingsModule; |
2
|
|
|
|
3
|
|
|
use Anomaly\SettingsModule\Setting\Command\ConfigureSystem; |
4
|
|
|
use Anomaly\Streams\Platform\Addon\AddonServiceProvider; |
5
|
|
|
use Anomaly\Streams\Platform\Application\Application; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class SettingsModuleServiceProvider |
9
|
|
|
* |
10
|
|
|
* @link http://pyrocms.com/ |
11
|
|
|
* @author PyroCMS, Inc. <[email protected]> |
12
|
|
|
* @author Ryan Thompson <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
class SettingsModuleServiceProvider extends AddonServiceProvider |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* The addon plugins. |
19
|
|
|
* |
20
|
|
|
* @var array |
21
|
|
|
*/ |
22
|
|
|
protected $plugins = [ |
23
|
|
|
'Anomaly\SettingsModule\SettingsModulePlugin', |
24
|
|
|
]; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* The addon listeners. |
28
|
|
|
* |
29
|
|
|
* @var array |
30
|
|
|
*/ |
31
|
|
|
protected $listeners = [ |
32
|
|
|
'Anomaly\SettingsModule\Setting\Event\SettingsWereSaved' => [ |
33
|
|
|
'Anomaly\SettingsModule\Setting\Listener\UpdateMaintenanceMode', |
34
|
|
|
], |
35
|
|
|
'Anomaly\Streams\Platform\Addon\Module\Event\ModuleWasUninstalled' => [ |
36
|
|
|
'Anomaly\SettingsModule\Setting\Listener\DeleteModuleSettings', |
37
|
|
|
], |
38
|
|
|
'Anomaly\Streams\Platform\Addon\Extension\Event\ExtensionWasUninstalled' => [ |
39
|
|
|
'Anomaly\SettingsModule\Setting\Listener\DeleteExtensionSettings', |
40
|
|
|
], |
41
|
|
|
]; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* The addon routes. |
45
|
|
|
* |
46
|
|
|
* @var array |
47
|
|
|
*/ |
48
|
|
|
protected $routes = [ |
49
|
|
|
'admin/settings' => 'Anomaly\SettingsModule\Http\Controller\Admin\SystemController@edit', |
50
|
|
|
'admin/settings/{type}' => 'Anomaly\SettingsModule\Http\Controller\Admin\AddonsController@index', |
51
|
|
|
'admin/settings/{type}/{addon}' => 'Anomaly\SettingsModule\Http\Controller\Admin\AddonsController@edit', |
52
|
|
|
]; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* The class bindings. |
56
|
|
|
* |
57
|
|
|
* @var array |
58
|
|
|
*/ |
59
|
|
|
protected $bindings = [ |
60
|
|
|
'Anomaly\Streams\Platform\Model\Settings\SettingsSettingsEntryModel' => 'Anomaly\SettingsModule\Setting\SettingModel', |
61
|
|
|
]; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* The singleton bindings. |
65
|
|
|
* |
66
|
|
|
* @var array |
67
|
|
|
*/ |
68
|
|
|
protected $singletons = [ |
69
|
|
|
'Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface' => 'Anomaly\SettingsModule\Setting\SettingRepository', |
70
|
|
|
]; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Configure Streams. |
74
|
|
|
* |
75
|
|
|
* @param Application $application |
76
|
|
|
*/ |
77
|
|
|
public function boot(Application $application) |
78
|
|
|
{ |
79
|
|
|
if (!$application->isInstalled()) { |
80
|
|
|
return; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
$this->dispatch(new ConfigureSystem()); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
} |
87
|
|
|
|