1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PWWEB\Artomator; |
4
|
|
|
|
5
|
|
|
use InfyOm\Generator\InfyOmGeneratorServiceProvider as ServiceProvider; |
6
|
|
|
use PWWEB\Artomator\Commands\API\APIControllerGeneratorCommand; |
7
|
|
|
use PWWEB\Artomator\Commands\API\APIGeneratorCommand; |
8
|
|
|
use PWWEB\Artomator\Commands\API\APIRequestsGeneratorCommand; |
9
|
|
|
use PWWEB\Artomator\Commands\API\TestsGeneratorCommand; |
10
|
|
|
use PWWEB\Artomator\Commands\APIScaffoldGeneratorCommand; |
11
|
|
|
use PWWEB\Artomator\Commands\Common\MigrationGeneratorCommand; |
12
|
|
|
use PWWEB\Artomator\Commands\Common\ModelGeneratorCommand; |
13
|
|
|
use PWWEB\Artomator\Commands\Common\RepositoryGeneratorCommand; |
14
|
|
|
use PWWEB\Artomator\Commands\GraphQL\GraphQLGeneratorCommand; |
15
|
|
|
use PWWEB\Artomator\Commands\GraphQL\GraphQLMutationsGeneratorCommand; |
16
|
|
|
use PWWEB\Artomator\Commands\GraphQL\GraphQLQueryGeneratorCommand; |
17
|
|
|
use PWWEB\Artomator\Commands\GraphQL\GraphQLSubscriptionGeneratorCommand; |
18
|
|
|
use PWWEB\Artomator\Commands\GraphQL\GraphQLTypeGeneratorCommand; |
19
|
|
|
use PWWEB\Artomator\Commands\GraphQLScaffoldGeneratorCommand; |
20
|
|
|
use PWWEB\Artomator\Commands\Publish\GeneratorPublishCommand; |
21
|
|
|
use PWWEB\Artomator\Commands\Publish\LayoutPublishCommand; |
22
|
|
|
use PWWEB\Artomator\Commands\Publish\PublishTemplateCommand; |
23
|
|
|
use PWWEB\Artomator\Commands\Publish\PublishUserCommand; |
24
|
|
|
use PWWEB\Artomator\Commands\RollbackGeneratorCommand; |
25
|
|
|
use PWWEB\Artomator\Commands\Scaffold\ControllerGeneratorCommand; |
26
|
|
|
use PWWEB\Artomator\Commands\Scaffold\RequestsGeneratorCommand; |
27
|
|
|
use PWWEB\Artomator\Commands\Scaffold\RoutesGeneratorCommand; |
28
|
|
|
use PWWEB\Artomator\Commands\Scaffold\ScaffoldGeneratorCommand; |
29
|
|
|
use PWWEB\Artomator\Commands\Scaffold\ViewsGeneratorCommand; |
30
|
|
|
|
31
|
|
|
class ArtomatorServiceProvider extends ServiceProvider |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* Bootstrap the application services. |
35
|
|
|
* |
36
|
|
|
* @return void |
37
|
|
|
*/ |
38
|
|
|
public function boot() |
39
|
|
|
{ |
40
|
|
|
$configPath = __DIR__.'/../config/artomator.php'; |
41
|
|
|
$configPathInfyom = __DIR__.'/../../../infyomlabs/laravel-generator/config/laravel_generator.php'; |
42
|
|
|
$schemaPath = __DIR__.'/../../../nuwave/lighthouse/assets/default-schema.graphql'; |
43
|
|
|
$configPathNuwave = __DIR__.'/../../../nuwave/lighthouse/src/lighthouse.php'; |
44
|
|
|
|
45
|
|
|
$this->publishes( |
46
|
|
|
[ |
47
|
|
|
$configPath => config_path('pwweb/artomator.php'), |
48
|
|
|
$configPathInfyom => config_path('infyom/laravel_generator.php'), |
49
|
|
|
$configPathNuwave => config_path('lighthouse.php'), |
50
|
|
|
$schemaPath => config('lighthouse.schema.register', base_path('graphql/schema.graphql')), |
51
|
|
|
], |
52
|
|
|
'artomator' |
53
|
|
|
); |
54
|
|
|
|
55
|
|
|
parent::boot(); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Register the application services. |
60
|
|
|
* |
61
|
|
|
* @return void |
62
|
|
|
*/ |
63
|
|
|
public function register() |
64
|
|
|
{ |
65
|
|
|
$this->app->singleton( |
66
|
|
|
'artomator.publish', |
67
|
|
|
function ($app) { |
|
|
|
|
68
|
|
|
return new GeneratorPublishCommand(); |
69
|
|
|
} |
70
|
|
|
); |
71
|
|
|
|
72
|
|
|
$this->app->singleton( |
73
|
|
|
'artomator.api', |
74
|
|
|
function ($app) { |
|
|
|
|
75
|
|
|
return new APIGeneratorCommand(); |
76
|
|
|
} |
77
|
|
|
); |
78
|
|
|
|
79
|
|
|
$this->app->singleton( |
80
|
|
|
'artomator.scaffold', |
81
|
|
|
function ($app) { |
|
|
|
|
82
|
|
|
return new ScaffoldGeneratorCommand(); |
83
|
|
|
} |
84
|
|
|
); |
85
|
|
|
|
86
|
|
|
$this->app->singleton( |
87
|
|
|
'artomator.publish.layout', |
88
|
|
|
function ($app) { |
|
|
|
|
89
|
|
|
return new LayoutPublishCommand(); |
90
|
|
|
} |
91
|
|
|
); |
92
|
|
|
|
93
|
|
|
$this->app->singleton( |
94
|
|
|
'artomator.publish.templates', |
95
|
|
|
function ($app) { |
|
|
|
|
96
|
|
|
return new PublishTemplateCommand(); |
97
|
|
|
} |
98
|
|
|
); |
99
|
|
|
|
100
|
|
|
$this->app->singleton( |
101
|
|
|
'artomator.api_scaffold', |
102
|
|
|
function ($app) { |
|
|
|
|
103
|
|
|
return new APIScaffoldGeneratorCommand(); |
104
|
|
|
} |
105
|
|
|
); |
106
|
|
|
|
107
|
|
|
$this->app->singleton( |
108
|
|
|
'artomator.migration', |
109
|
|
|
function ($app) { |
|
|
|
|
110
|
|
|
return new MigrationGeneratorCommand(); |
111
|
|
|
} |
112
|
|
|
); |
113
|
|
|
|
114
|
|
|
$this->app->singleton( |
115
|
|
|
'artomator.model', |
116
|
|
|
function ($app) { |
|
|
|
|
117
|
|
|
return new ModelGeneratorCommand(); |
118
|
|
|
} |
119
|
|
|
); |
120
|
|
|
|
121
|
|
|
$this->app->singleton( |
122
|
|
|
'artomator.repository', |
123
|
|
|
function ($app) { |
|
|
|
|
124
|
|
|
return new RepositoryGeneratorCommand(); |
125
|
|
|
} |
126
|
|
|
); |
127
|
|
|
|
128
|
|
|
$this->app->singleton( |
129
|
|
|
'artomator.api.controller', |
130
|
|
|
function ($app) { |
|
|
|
|
131
|
|
|
return new APIControllerGeneratorCommand(); |
132
|
|
|
} |
133
|
|
|
); |
134
|
|
|
|
135
|
|
|
$this->app->singleton( |
136
|
|
|
'artomator.api.requests', |
137
|
|
|
function ($app) { |
|
|
|
|
138
|
|
|
return new APIRequestsGeneratorCommand(); |
139
|
|
|
} |
140
|
|
|
); |
141
|
|
|
|
142
|
|
|
$this->app->singleton( |
143
|
|
|
'artomator.api.tests', |
144
|
|
|
function ($app) { |
|
|
|
|
145
|
|
|
return new TestsGeneratorCommand(); |
146
|
|
|
} |
147
|
|
|
); |
148
|
|
|
|
149
|
|
|
$this->app->singleton( |
150
|
|
|
'artomator.scaffold.controller', |
151
|
|
|
function ($app) { |
|
|
|
|
152
|
|
|
return new ControllerGeneratorCommand(); |
153
|
|
|
} |
154
|
|
|
); |
155
|
|
|
|
156
|
|
|
$this->app->singleton( |
157
|
|
|
'artomator.scaffold.requests', |
158
|
|
|
function ($app) { |
|
|
|
|
159
|
|
|
return new RequestsGeneratorCommand(); |
160
|
|
|
} |
161
|
|
|
); |
162
|
|
|
|
163
|
|
|
$this->app->singleton( |
164
|
|
|
'artomator.scaffold.views', |
165
|
|
|
function ($app) { |
|
|
|
|
166
|
|
|
return new ViewsGeneratorCommand(); |
167
|
|
|
} |
168
|
|
|
); |
169
|
|
|
|
170
|
|
|
$this->app->singleton( |
171
|
|
|
'artomator.scaffold.routes', |
172
|
|
|
function ($app) { |
|
|
|
|
173
|
|
|
return new RoutesGeneratorCommand(); |
174
|
|
|
} |
175
|
|
|
); |
176
|
|
|
|
177
|
|
|
$this->app->singleton( |
178
|
|
|
'artomator.rollback', |
179
|
|
|
function ($app) { |
|
|
|
|
180
|
|
|
return new RollbackGeneratorCommand(); |
181
|
|
|
} |
182
|
|
|
); |
183
|
|
|
|
184
|
|
|
$this->app->singleton( |
185
|
|
|
'artomator.publish.user', |
186
|
|
|
function ($app) { |
|
|
|
|
187
|
|
|
return new PublishUserCommand(); |
188
|
|
|
} |
189
|
|
|
); |
190
|
|
|
|
191
|
|
|
$this->app->singleton( |
192
|
|
|
'artomator.graphql', |
193
|
|
|
function ($app) { |
|
|
|
|
194
|
|
|
return new GraphQLGeneratorCommand(); |
195
|
|
|
} |
196
|
|
|
); |
197
|
|
|
|
198
|
|
|
$this->app->singleton( |
199
|
|
|
'artomator.graphql_scaffold', |
200
|
|
|
function ($app) { |
|
|
|
|
201
|
|
|
return new GraphQLScaffoldGeneratorCommand(); |
202
|
|
|
} |
203
|
|
|
); |
204
|
|
|
|
205
|
|
|
$this->app->singleton( |
206
|
|
|
'artomator.graphql.query', |
207
|
|
|
function ($app) { |
|
|
|
|
208
|
|
|
return new GraphQLQueryGeneratorCommand(); |
209
|
|
|
} |
210
|
|
|
); |
211
|
|
|
|
212
|
|
|
$this->app->singleton( |
213
|
|
|
'artomator.graphql.mutations', |
214
|
|
|
function ($app) { |
|
|
|
|
215
|
|
|
return new GraphQLMutationsGeneratorCommand(); |
216
|
|
|
} |
217
|
|
|
); |
218
|
|
|
|
219
|
|
|
$this->app->singleton( |
220
|
|
|
'artomator.graphql.type', |
221
|
|
|
function ($app) { |
|
|
|
|
222
|
|
|
return new GraphQLTypeGeneratorCommand(); |
223
|
|
|
} |
224
|
|
|
); |
225
|
|
|
|
226
|
|
|
$this->app->singleton( |
227
|
|
|
'artomator.graphql.subscription', |
228
|
|
|
function ($app) { |
|
|
|
|
229
|
|
|
return new GraphQLSubscriptionGeneratorCommand(); |
230
|
|
|
} |
231
|
|
|
); |
232
|
|
|
|
233
|
|
|
parent::register(); |
234
|
|
|
|
235
|
|
|
$this->commands( |
236
|
|
|
[ |
237
|
|
|
'artomator.publish', |
238
|
|
|
'artomator.api', |
239
|
|
|
'artomator.scaffold', |
240
|
|
|
'artomator.api_scaffold', |
241
|
|
|
'artomator.publish.layout', |
242
|
|
|
'artomator.publish.templates', |
243
|
|
|
'artomator.migration', |
244
|
|
|
'artomator.model', |
245
|
|
|
'artomator.repository', |
246
|
|
|
'artomator.api.controller', |
247
|
|
|
'artomator.api.requests', |
248
|
|
|
'artomator.api.tests', |
249
|
|
|
'artomator.scaffold.controller', |
250
|
|
|
'artomator.scaffold.requests', |
251
|
|
|
'artomator.scaffold.views', |
252
|
|
|
'artomator.scaffold.routes', |
253
|
|
|
'artomator.rollback', |
254
|
|
|
'artomator.publish.user', |
255
|
|
|
'artomator.graphql', |
256
|
|
|
'artomator.graphql_scaffold', |
257
|
|
|
'artomator.graphql.query', |
258
|
|
|
'artomator.graphql.mutations', |
259
|
|
|
'artomator.graphql.type', |
260
|
|
|
'artomator.graphql.subscription', |
261
|
|
|
] |
262
|
|
|
); |
263
|
|
|
} |
264
|
|
|
} |
265
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.