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