|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Nwidart\Modules\Providers; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Support\Str; |
|
6
|
|
|
use Illuminate\Support\ServiceProvider; |
|
7
|
|
|
use Nwidart\Modules\Commands\UseCommand; |
|
8
|
|
|
use Nwidart\Modules\Commands\DumpCommand; |
|
9
|
|
|
use Nwidart\Modules\Commands\ListCommand; |
|
10
|
|
|
use Nwidart\Modules\Commands\SeedCommand; |
|
11
|
|
|
use Nwidart\Modules\Commands\SetupCommand; |
|
12
|
|
|
use Nwidart\Modules\Commands\UnUseCommand; |
|
13
|
|
|
use Nwidart\Modules\Commands\EnableCommand; |
|
14
|
|
|
use Nwidart\Modules\Commands\UpdateCommand; |
|
15
|
|
|
use Nwidart\Modules\Commands\DisableCommand; |
|
16
|
|
|
use Nwidart\Modules\Commands\InstallCommand; |
|
17
|
|
|
use Nwidart\Modules\Commands\JobMakeCommand; |
|
18
|
|
|
use Nwidart\Modules\Commands\MigrateCommand; |
|
19
|
|
|
use Nwidart\Modules\Commands\PublishCommand; |
|
20
|
|
|
use Nwidart\Modules\Commands\MailMakeCommand; |
|
21
|
|
|
use Nwidart\Modules\Commands\RuleMakeCommand; |
|
22
|
|
|
use Nwidart\Modules\Commands\SeedMakeCommand; |
|
23
|
|
|
use Nwidart\Modules\Commands\TestMakeCommand; |
|
24
|
|
|
use Nwidart\Modules\Commands\EventMakeCommand; |
|
25
|
|
|
use Nwidart\Modules\Commands\ModelMakeCommand; |
|
26
|
|
|
use Nwidart\Modules\Commands\ModuleMakeCommand; |
|
27
|
|
|
use Nwidart\Modules\Commands\PolicyMakeCommand; |
|
28
|
|
|
use Nwidart\Modules\Commands\CommandMakeCommand; |
|
29
|
|
|
use Nwidart\Modules\Commands\FactoryMakeCommand; |
|
30
|
|
|
use Nwidart\Modules\Commands\RequestMakeCommand; |
|
31
|
|
|
use Nwidart\Modules\Commands\ListenerMakeCommand; |
|
32
|
|
|
use Nwidart\Modules\Commands\MigrateResetCommand; |
|
33
|
|
|
use Nwidart\Modules\Commands\ModuleDeleteCommand; |
|
34
|
|
|
use Nwidart\Modules\Commands\ProviderMakeCommand; |
|
35
|
|
|
use Nwidart\Modules\Commands\ResourceMakeCommand; |
|
36
|
|
|
use Nwidart\Modules\Commands\MigrateStatusCommand; |
|
37
|
|
|
use Nwidart\Modules\Commands\MigrationMakeCommand; |
|
38
|
|
|
use Nwidart\Modules\Commands\ControllerMakeCommand; |
|
39
|
|
|
use Nwidart\Modules\Commands\MiddlewareMakeCommand; |
|
40
|
|
|
use Nwidart\Modules\Commands\MigrateRefreshCommand; |
|
41
|
|
|
use Nwidart\Modules\Commands\MigrateRollbackCommand; |
|
42
|
|
|
use Nwidart\Modules\Commands\NotificationMakeCommand; |
|
43
|
|
|
use Nwidart\Modules\Commands\PublishMigrationCommand; |
|
44
|
|
|
use Nwidart\Modules\Commands\LaravelModulesV6Migrator; |
|
45
|
|
|
use Nwidart\Modules\Commands\RouteProviderMakeCommand; |
|
46
|
|
|
use Nwidart\Modules\Commands\PublishTranslationCommand; |
|
47
|
|
|
use Nwidart\Modules\Commands\PublishConfigurationCommand; |
|
48
|
|
|
|
|
49
|
|
|
class ConsoleServiceProvider extends ServiceProvider |
|
50
|
|
|
{ |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Namespace of the console commands |
|
54
|
|
|
* |
|
55
|
|
|
* @var string |
|
56
|
|
|
*/ |
|
57
|
|
|
protected $consoleNamespace = "Nwidart\\Modules\\Commands"; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* The available commands |
|
61
|
|
|
* |
|
62
|
|
|
* @var array |
|
63
|
|
|
*/ |
|
64
|
|
|
protected $commands = [ |
|
65
|
|
|
CommandMakeCommand::class, |
|
66
|
|
|
ControllerMakeCommand::class, |
|
67
|
|
|
DisableCommand::class, |
|
68
|
|
|
DumpCommand::class, |
|
69
|
|
|
EnableCommand::class, |
|
70
|
|
|
EventMakeCommand::class, |
|
71
|
|
|
JobMakeCommand::class, |
|
72
|
|
|
ListenerMakeCommand::class, |
|
73
|
|
|
MailMakeCommand::class, |
|
74
|
|
|
MiddlewareMakeCommand::class, |
|
75
|
|
|
NotificationMakeCommand::class, |
|
76
|
|
|
ProviderMakeCommand::class, |
|
77
|
|
|
RouteProviderMakeCommand::class, |
|
78
|
|
|
InstallCommand::class, |
|
79
|
|
|
ListCommand::class, |
|
80
|
|
|
ModuleDeleteCommand::class, |
|
81
|
|
|
ModuleMakeCommand::class, |
|
82
|
|
|
FactoryMakeCommand::class, |
|
83
|
|
|
PolicyMakeCommand::class, |
|
84
|
|
|
RequestMakeCommand::class, |
|
85
|
|
|
RuleMakeCommand::class, |
|
86
|
|
|
MigrateCommand::class, |
|
87
|
|
|
MigrateRefreshCommand::class, |
|
88
|
|
|
MigrateResetCommand::class, |
|
89
|
|
|
MigrateRollbackCommand::class, |
|
90
|
|
|
MigrateStatusCommand::class, |
|
91
|
|
|
MigrationMakeCommand::class, |
|
92
|
|
|
ModelMakeCommand::class, |
|
93
|
|
|
PublishCommand::class, |
|
94
|
|
|
PublishConfigurationCommand::class, |
|
95
|
|
|
PublishMigrationCommand::class, |
|
96
|
|
|
PublishTranslationCommand::class, |
|
97
|
|
|
SeedCommand::class, |
|
98
|
|
|
SeedMakeCommand::class, |
|
99
|
|
|
SetupCommand::class, |
|
100
|
|
|
UnUseCommand::class, |
|
101
|
|
|
UpdateCommand::class, |
|
102
|
230 |
|
UseCommand::class, |
|
103
|
|
|
ResourceMakeCommand::class, |
|
104
|
230 |
|
TestMakeCommand::class, |
|
105
|
230 |
|
LaravelModulesV6Migrator::class, |
|
106
|
|
|
]; |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* Register the commands. |
|
110
|
|
|
*/ |
|
111
|
|
|
public function register() |
|
112
|
|
|
{ |
|
113
|
|
|
$this->commands($this->resolveCommands()); |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* Resolve package commands |
|
118
|
|
|
* |
|
119
|
|
|
* @return array |
|
120
|
|
|
*/ |
|
121
|
|
|
private function resolveCommands() |
|
122
|
|
|
{ |
|
123
|
|
|
$commands = []; |
|
124
|
|
|
|
|
125
|
|
|
foreach (config('modules.commands', $this->commands) as $command) { |
|
126
|
|
|
$commands[] = Str::contains($command, $this->consoleNamespace) ? |
|
127
|
|
|
$command : |
|
128
|
|
|
$this->consoleNamespace . "\\"; |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
return $commands; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* @return array |
|
136
|
|
|
*/ |
|
137
|
|
|
public function provides() |
|
138
|
|
|
{ |
|
139
|
|
|
$provides = $this->commands; |
|
140
|
|
|
|
|
141
|
|
|
return $provides; |
|
142
|
|
|
} |
|
143
|
|
|
} |
|
144
|
|
|
|