1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Terranet\Administrator\Providers; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
use Terranet\Administrator\Console\ActionMakeCommand; |
7
|
|
|
use Terranet\Administrator\Console\ActionsMakeCommand; |
8
|
|
|
use Terranet\Administrator\Console\AdministratorCreateCommand; |
9
|
|
|
use Terranet\Administrator\Console\BreadcrumbsMakeCommand; |
10
|
|
|
use Terranet\Administrator\Console\FinderMakeCommand; |
11
|
|
|
use Terranet\Administrator\Console\LanguagesMakeCommand; |
12
|
|
|
use Terranet\Administrator\Console\PanelMakeCommand; |
13
|
|
|
use Terranet\Administrator\Console\PublishCommand; |
14
|
|
|
use Terranet\Administrator\Console\ResourceMakeCommand; |
15
|
|
|
use Terranet\Administrator\Console\SaverMakeCommand; |
16
|
|
|
use Terranet\Administrator\Console\SettingsMakeCommand; |
17
|
|
|
use Terranet\Administrator\Console\TemplateMakeCommand; |
18
|
|
|
|
19
|
|
|
class ArtisanServiceProvider extends ServiceProvider |
20
|
|
|
{ |
21
|
|
|
protected $commands = [ |
22
|
|
|
'AdminPublish' => 'command.administrator.publish', |
23
|
|
|
'AdminCreate' => 'command.administrator.create', |
24
|
|
|
'AdminModule' => 'command.administrator.module', |
25
|
|
|
'AdminActions' => 'command.administrator.actions', |
26
|
|
|
'AdminAction' => 'command.administrator.action', |
27
|
|
|
'AdminSaver' => 'command.administrator.saver', |
28
|
|
|
'AdminTemplate' => 'command.administrator.template', |
29
|
|
|
'AdminPanel' => 'command.administrator.panel', |
30
|
|
|
'AdminFinder' => 'command.administrator.finder', |
31
|
|
|
'AdminSettings' => 'command.administrator.settings', |
32
|
|
|
'AdminLanguages' => 'command.administrator.languages', |
33
|
|
|
'AdminBreadcrumbs' => 'command.administrator.breadcrumbs', |
34
|
|
|
]; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Register the service provider. |
38
|
|
|
*/ |
39
|
|
|
public function register() |
40
|
|
|
{ |
41
|
|
|
foreach (array_keys($this->commands) as $command) { |
42
|
|
|
$method = "register{$command}Command"; |
43
|
|
|
|
44
|
|
|
\call_user_func_array([$this, $method], []); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
$this->commands(array_values($this->commands)); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
protected function registerAdminPublishCommand() |
51
|
|
|
{ |
52
|
|
|
$this->app->singleton('command.administrator.publish', function () { |
53
|
|
|
return new PublishCommand(); |
54
|
|
|
}); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
protected function registerAdminCreateCommand() |
58
|
|
|
{ |
59
|
|
|
$this->app->singleton('command.administrator.create', function ($app) { |
60
|
|
|
return new AdministratorCreateCommand($app['hash']); |
61
|
|
|
}); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
protected function registerAdminModuleCommand() |
65
|
|
|
{ |
66
|
|
|
$this->app->singleton('command.administrator.module', function ($app) { |
67
|
|
|
return new ResourceMakeCommand($app['files']); |
68
|
|
|
}); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
protected function registerAdminActionsCommand() |
72
|
|
|
{ |
73
|
|
|
$this->app->singleton('command.administrator.actions', function ($app) { |
74
|
|
|
return new ActionsMakeCommand($app['files']); |
75
|
|
|
}); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
protected function registerAdminActionCommand() |
79
|
|
|
{ |
80
|
|
|
$this->app->singleton('command.administrator.action', function ($app) { |
81
|
|
|
return new ActionMakeCommand($app['files']); |
82
|
|
|
}); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
protected function registerAdminPanelCommand() |
86
|
|
|
{ |
87
|
|
|
$this->app->singleton('command.administrator.panel', function ($app) { |
88
|
|
|
return new PanelMakeCommand($app['files']); |
89
|
|
|
}); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
protected function registerAdminSaverCommand() |
93
|
|
|
{ |
94
|
|
|
$this->app->singleton('command.administrator.saver', function ($app) { |
95
|
|
|
return new SaverMakeCommand($app['files']); |
96
|
|
|
}); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
protected function registerAdminTemplateCommand() |
100
|
|
|
{ |
101
|
|
|
$this->app->singleton('command.administrator.template', function ($app) { |
102
|
|
|
return new TemplateMakeCommand($app['files']); |
103
|
|
|
}); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
protected function registerAdminFinderCommand() |
107
|
|
|
{ |
108
|
|
|
$this->app->singleton('command.administrator.finder', function ($app) { |
109
|
|
|
return new FinderMakeCommand($app['files']); |
110
|
|
|
}); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
protected function registerAdminBreadcrumbsCommand() |
114
|
|
|
{ |
115
|
|
|
$this->app->singleton('command.administrator.breadcrumbs', function ($app) { |
116
|
|
|
return new BreadcrumbsMakeCommand($app['files']); |
117
|
|
|
}); |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
protected function registerAdminSettingsCommand() |
121
|
|
|
{ |
122
|
|
|
$this->app->singleton('command.administrator.settings', function ($app) { |
123
|
|
|
return new SettingsMakeCommand($app['files']); |
124
|
|
|
}); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
protected function registerAdminLanguagesCommand() |
128
|
|
|
{ |
129
|
|
|
$this->app->singleton('command.administrator.languages', function ($app) { |
130
|
|
|
return new LanguagesMakeCommand($app['files']); |
131
|
|
|
}); |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
|