|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ikechukwukalu\Magicmake\Console\Commands; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Console\Command; |
|
6
|
|
|
use Illuminate\Filesystem\Filesystem; |
|
7
|
|
|
use Illuminate\Support\Str; |
|
8
|
|
|
use Symfony\Component\Finder\SplFileInfo; |
|
9
|
|
|
|
|
10
|
|
|
class InitCommands extends Command |
|
11
|
|
|
{ |
|
12
|
|
|
|
|
13
|
|
|
protected function handleAppActionPath() |
|
14
|
|
|
{ |
|
15
|
|
|
if (! is_dir($directory = app_path('Actions'))) { |
|
16
|
|
|
mkdir($directory, 0755, true); |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
$filesystem = new Filesystem; |
|
20
|
|
|
|
|
21
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Actions')) |
|
|
|
|
|
|
22
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
23
|
|
|
$filesystem->copy( |
|
24
|
|
|
$file->getPathname(), |
|
25
|
|
|
app_path('Actions/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
26
|
|
|
); |
|
27
|
|
|
}); |
|
28
|
|
|
|
|
29
|
|
|
$this->components->info('Action classes scaffolding generated successfully.'); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
protected function handleAppContractsPath() |
|
33
|
|
|
{ |
|
34
|
|
|
if (! is_dir($directory = app_path('Contracts'))) { |
|
35
|
|
|
mkdir($directory, 0755, true); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
$filesystem = new Filesystem; |
|
39
|
|
|
|
|
40
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Contracts')) |
|
|
|
|
|
|
41
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
42
|
|
|
$filesystem->copy( |
|
43
|
|
|
$file->getPathname(), |
|
44
|
|
|
app_path('Contracts/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
45
|
|
|
); |
|
46
|
|
|
}); |
|
47
|
|
|
|
|
48
|
|
|
$this->components->info('Contract classes scaffolding generated successfully.'); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
protected function handleAppEnumsPath() |
|
52
|
|
|
{ |
|
53
|
|
|
if (! is_dir($directory = app_path('Enums'))) { |
|
54
|
|
|
mkdir($directory, 0755, true); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
$filesystem = new Filesystem; |
|
58
|
|
|
|
|
59
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Enums')) |
|
|
|
|
|
|
60
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
61
|
|
|
$filesystem->copy( |
|
62
|
|
|
$file->getPathname(), |
|
63
|
|
|
app_path('Enums/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
64
|
|
|
); |
|
65
|
|
|
}); |
|
66
|
|
|
|
|
67
|
|
|
$this->components->info('Enum classes scaffolding generated successfully.'); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
protected function handleAppEventsPath() |
|
71
|
|
|
{ |
|
72
|
|
|
if (! is_dir($directory = app_path('Events'))) { |
|
73
|
|
|
mkdir($directory, 0755, true); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
$filesystem = new Filesystem; |
|
77
|
|
|
|
|
78
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Events')) |
|
|
|
|
|
|
79
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
80
|
|
|
$filesystem->copy( |
|
81
|
|
|
$file->getPathname(), |
|
82
|
|
|
app_path('Events/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
83
|
|
|
); |
|
84
|
|
|
}); |
|
85
|
|
|
|
|
86
|
|
|
$this->components->info('Event classes scaffolding generated successfully.'); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
protected function handleAppExceptionsPath() |
|
90
|
|
|
{ |
|
91
|
|
|
if (! is_dir($directory = app_path('Exceptions'))) { |
|
92
|
|
|
mkdir($directory, 0755, true); |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
$filesystem = new Filesystem; |
|
96
|
|
|
|
|
97
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Exceptions')) |
|
|
|
|
|
|
98
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
99
|
|
|
$filesystem->copy( |
|
100
|
|
|
$file->getPathname(), |
|
101
|
|
|
app_path('Exceptions/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
102
|
|
|
); |
|
103
|
|
|
}); |
|
104
|
|
|
|
|
105
|
|
|
$this->components->info('Exception classes scaffolding generated successfully.'); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
protected function handleAppFacadesPath() |
|
109
|
|
|
{ |
|
110
|
|
|
if (! is_dir($directory = app_path('Facades'))) { |
|
111
|
|
|
mkdir($directory, 0755, true); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
$filesystem = new Filesystem; |
|
115
|
|
|
|
|
116
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Facades')) |
|
|
|
|
|
|
117
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
118
|
|
|
$filesystem->copy( |
|
119
|
|
|
$file->getPathname(), |
|
120
|
|
|
app_path('Facades/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
121
|
|
|
); |
|
122
|
|
|
}); |
|
123
|
|
|
|
|
124
|
|
|
$this->components->info('Facades classes scaffolding generated successfully.'); |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
protected function handleAppHttpPath() |
|
128
|
|
|
{ |
|
129
|
|
|
if (! is_dir($directory = app_path('Http'))) { |
|
130
|
|
|
mkdir($directory, 0755, true); |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
$filesystem = new Filesystem; |
|
134
|
|
|
|
|
135
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Http')) |
|
|
|
|
|
|
136
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
137
|
|
|
$filesystem->copy( |
|
138
|
|
|
$file->getPathname(), |
|
139
|
|
|
app_path('Http/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
140
|
|
|
); |
|
141
|
|
|
}); |
|
142
|
|
|
|
|
143
|
|
|
$this->components->info('Http classes scaffolding generated successfully.'); |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
protected function handleAppHttpControllersPath() |
|
147
|
|
|
{ |
|
148
|
|
|
if (! is_dir($directory = app_path('Http/Controllers'))) { |
|
149
|
|
|
mkdir($directory, 0755, true); |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
$filesystem = new Filesystem; |
|
153
|
|
|
|
|
154
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Controllers')) |
|
|
|
|
|
|
155
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
156
|
|
|
$filesystem->copy( |
|
157
|
|
|
$file->getPathname(), |
|
158
|
|
|
app_path('Http/Controllers/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
159
|
|
|
); |
|
160
|
|
|
}); |
|
161
|
|
|
|
|
162
|
|
|
$this->components->info('Http/Controllers classes scaffolding generated successfully.'); |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
protected function handleAppHttpControllersAuthPath() |
|
166
|
|
|
{ |
|
167
|
|
|
if (! is_dir($directory = app_path('Http/Controllers/Auth'))) { |
|
168
|
|
|
mkdir($directory, 0755, true); |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
$filesystem = new Filesystem; |
|
172
|
|
|
|
|
173
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/AuthControllers')) |
|
|
|
|
|
|
174
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
175
|
|
|
$filesystem->copy( |
|
176
|
|
|
$file->getPathname(), |
|
177
|
|
|
app_path('Http/Controllers/Auth/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
178
|
|
|
); |
|
179
|
|
|
}); |
|
180
|
|
|
|
|
181
|
|
|
$this->components->info('Http/Controllers/Auth classes scaffolding generated successfully.'); |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
protected function handleAppHttpMiddlewarePath() |
|
185
|
|
|
{ |
|
186
|
|
|
if (! is_dir($directory = app_path('Http/Middleware'))) { |
|
187
|
|
|
mkdir($directory, 0755, true); |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
$filesystem = new Filesystem; |
|
191
|
|
|
|
|
192
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Middleware')) |
|
|
|
|
|
|
193
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
194
|
|
|
$filesystem->copy( |
|
195
|
|
|
$file->getPathname(), |
|
196
|
|
|
app_path('Http/Middleware/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
197
|
|
|
); |
|
198
|
|
|
}); |
|
199
|
|
|
|
|
200
|
|
|
$this->components->info('Http/Middleware classes scaffolding generated successfully.'); |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
protected function handleAppHttpRequestsPath() |
|
204
|
|
|
{ |
|
205
|
|
|
if (! is_dir($directory = app_path('Http/Requests'))) { |
|
206
|
|
|
mkdir($directory, 0755, true); |
|
207
|
|
|
} |
|
208
|
|
|
|
|
209
|
|
|
$filesystem = new Filesystem; |
|
210
|
|
|
|
|
211
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Requests')) |
|
|
|
|
|
|
212
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
213
|
|
|
$filesystem->copy( |
|
214
|
|
|
$file->getPathname(), |
|
215
|
|
|
app_path('Http/Requests/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
216
|
|
|
); |
|
217
|
|
|
}); |
|
218
|
|
|
|
|
219
|
|
|
$this->components->info('Http/Requests classes scaffolding generated successfully.'); |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
protected function handleAppHttpRequestsAuthPath() |
|
223
|
|
|
{ |
|
224
|
|
|
if (! is_dir($directory = app_path('Http/Requests/Auth'))) { |
|
225
|
|
|
mkdir($directory, 0755, true); |
|
226
|
|
|
} |
|
227
|
|
|
|
|
228
|
|
|
$filesystem = new Filesystem; |
|
229
|
|
|
|
|
230
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/AuthRequests')) |
|
|
|
|
|
|
231
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
232
|
|
|
$filesystem->copy( |
|
233
|
|
|
$file->getPathname(), |
|
234
|
|
|
app_path('Http/Requests/Auth/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
235
|
|
|
); |
|
236
|
|
|
}); |
|
237
|
|
|
|
|
238
|
|
|
$this->components->info('Http/Requests/Auth classes scaffolding generated successfully.'); |
|
239
|
|
|
} |
|
240
|
|
|
|
|
241
|
|
|
protected function handleAppListenersPath() |
|
242
|
|
|
{ |
|
243
|
|
|
if (! is_dir($directory = app_path('Listeners'))) { |
|
244
|
|
|
mkdir($directory, 0755, true); |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
$filesystem = new Filesystem; |
|
248
|
|
|
|
|
249
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Listeners')) |
|
|
|
|
|
|
250
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
251
|
|
|
$filesystem->copy( |
|
252
|
|
|
$file->getPathname(), |
|
253
|
|
|
app_path('Listeners/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
254
|
|
|
); |
|
255
|
|
|
}); |
|
256
|
|
|
|
|
257
|
|
|
$this->components->info('Listener classes scaffolding generated successfully.'); |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
protected function handleAppModelsPath() |
|
261
|
|
|
{ |
|
262
|
|
|
if (! is_dir($directory = app_path('Models'))) { |
|
263
|
|
|
mkdir($directory, 0755, true); |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
$filesystem = new Filesystem; |
|
267
|
|
|
|
|
268
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Models')) |
|
|
|
|
|
|
269
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
270
|
|
|
$filesystem->copy( |
|
271
|
|
|
$file->getPathname(), |
|
272
|
|
|
app_path('Models/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
273
|
|
|
); |
|
274
|
|
|
}); |
|
275
|
|
|
|
|
276
|
|
|
$this->components->info('Models classes scaffolding generated successfully.'); |
|
277
|
|
|
} |
|
278
|
|
|
|
|
279
|
|
|
protected function handleAppModelsScopesPath() |
|
280
|
|
|
{ |
|
281
|
|
|
if (! is_dir($directory = app_path('Models/Scopes'))) { |
|
282
|
|
|
mkdir($directory, 0755, true); |
|
283
|
|
|
} |
|
284
|
|
|
|
|
285
|
|
|
$filesystem = new Filesystem; |
|
286
|
|
|
|
|
287
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/ModelsScopes')) |
|
|
|
|
|
|
288
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
289
|
|
|
$filesystem->copy( |
|
290
|
|
|
$file->getPathname(), |
|
291
|
|
|
app_path('Models/Scopes/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
292
|
|
|
); |
|
293
|
|
|
}); |
|
294
|
|
|
|
|
295
|
|
|
$this->components->info('Models/Scopes classes scaffolding generated successfully.'); |
|
296
|
|
|
} |
|
297
|
|
|
|
|
298
|
|
|
protected function handleAppNotificationsPath() |
|
299
|
|
|
{ |
|
300
|
|
|
if (! is_dir($directory = app_path('Notifications'))) { |
|
301
|
|
|
mkdir($directory, 0755, true); |
|
302
|
|
|
} |
|
303
|
|
|
|
|
304
|
|
|
$filesystem = new Filesystem; |
|
305
|
|
|
|
|
306
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Notifications')) |
|
|
|
|
|
|
307
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
308
|
|
|
$filesystem->copy( |
|
309
|
|
|
$file->getPathname(), |
|
310
|
|
|
app_path('Notifications/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
311
|
|
|
); |
|
312
|
|
|
}); |
|
313
|
|
|
|
|
314
|
|
|
$this->components->info('Notification classes scaffolding generated successfully.'); |
|
315
|
|
|
} |
|
316
|
|
|
|
|
317
|
|
|
protected function handleAppProvidersPath() |
|
318
|
|
|
{ |
|
319
|
|
|
if (! is_dir($directory = app_path('Providers'))) { |
|
320
|
|
|
mkdir($directory, 0755, true); |
|
321
|
|
|
} |
|
322
|
|
|
|
|
323
|
|
|
$filesystem = new Filesystem; |
|
324
|
|
|
|
|
325
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Providers')) |
|
|
|
|
|
|
326
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
327
|
|
|
$filesystem->copy( |
|
328
|
|
|
$file->getPathname(), |
|
329
|
|
|
app_path('Providers/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
330
|
|
|
); |
|
331
|
|
|
}); |
|
332
|
|
|
|
|
333
|
|
|
$this->components->info('Provider classes scaffolding generated successfully.'); |
|
334
|
|
|
} |
|
335
|
|
|
|
|
336
|
|
|
protected function handleAppRepositoriesPath() |
|
337
|
|
|
{ |
|
338
|
|
|
if (! is_dir($directory = app_path('Repositories'))) { |
|
339
|
|
|
mkdir($directory, 0755, true); |
|
340
|
|
|
} |
|
341
|
|
|
|
|
342
|
|
|
$filesystem = new Filesystem; |
|
343
|
|
|
|
|
344
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Repositories')) |
|
|
|
|
|
|
345
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
346
|
|
|
$filesystem->copy( |
|
347
|
|
|
$file->getPathname(), |
|
348
|
|
|
app_path('Repositories/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
349
|
|
|
); |
|
350
|
|
|
}); |
|
351
|
|
|
|
|
352
|
|
|
$this->components->info('Repository classes scaffolding generated successfully.'); |
|
353
|
|
|
} |
|
354
|
|
|
|
|
355
|
|
|
protected function handleAppRulesPath() |
|
356
|
|
|
{ |
|
357
|
|
|
if (! is_dir($directory = app_path('Rules'))) { |
|
358
|
|
|
mkdir($directory, 0755, true); |
|
359
|
|
|
} |
|
360
|
|
|
|
|
361
|
|
|
$filesystem = new Filesystem; |
|
362
|
|
|
|
|
363
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Rules')) |
|
|
|
|
|
|
364
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
365
|
|
|
$filesystem->copy( |
|
366
|
|
|
$file->getPathname(), |
|
367
|
|
|
app_path('Rules/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
368
|
|
|
); |
|
369
|
|
|
}); |
|
370
|
|
|
|
|
371
|
|
|
$this->components->info('Rule classes scaffolding generated successfully.'); |
|
372
|
|
|
} |
|
373
|
|
|
|
|
374
|
|
|
protected function handleAppServicesPath() |
|
375
|
|
|
{ |
|
376
|
|
|
if (! is_dir($directory = app_path('Services'))) { |
|
377
|
|
|
mkdir($directory, 0755, true); |
|
378
|
|
|
} |
|
379
|
|
|
|
|
380
|
|
|
$filesystem = new Filesystem; |
|
381
|
|
|
|
|
382
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Services')) |
|
|
|
|
|
|
383
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
384
|
|
|
$filesystem->copy( |
|
385
|
|
|
$file->getPathname(), |
|
386
|
|
|
app_path('Services/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
387
|
|
|
); |
|
388
|
|
|
}); |
|
389
|
|
|
|
|
390
|
|
|
$this->components->info('Service classes scaffolding generated successfully.'); |
|
391
|
|
|
} |
|
392
|
|
|
|
|
393
|
|
|
protected function handleAppServicesAuthPath() |
|
394
|
|
|
{ |
|
395
|
|
|
if (! is_dir($directory = app_path('Services/Auth'))) { |
|
396
|
|
|
mkdir($directory, 0755, true); |
|
397
|
|
|
} |
|
398
|
|
|
|
|
399
|
|
|
$filesystem = new Filesystem; |
|
400
|
|
|
|
|
401
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/AuthServices')) |
|
|
|
|
|
|
402
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
403
|
|
|
$filesystem->copy( |
|
404
|
|
|
$file->getPathname(), |
|
405
|
|
|
app_path('Services/Auth/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
406
|
|
|
); |
|
407
|
|
|
}); |
|
408
|
|
|
|
|
409
|
|
|
$this->components->info('Service/Auth classes scaffolding generated successfully.'); |
|
410
|
|
|
} |
|
411
|
|
|
|
|
412
|
|
|
protected function handleAppTraitsPath() |
|
413
|
|
|
{ |
|
414
|
|
|
if (! is_dir($directory = app_path('Traits'))) { |
|
415
|
|
|
mkdir($directory, 0755, true); |
|
416
|
|
|
} |
|
417
|
|
|
|
|
418
|
|
|
$filesystem = new Filesystem; |
|
419
|
|
|
|
|
420
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/app/Traits')) |
|
|
|
|
|
|
421
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
422
|
|
|
$filesystem->copy( |
|
423
|
|
|
$file->getPathname(), |
|
424
|
|
|
app_path('Traits/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
425
|
|
|
); |
|
426
|
|
|
}); |
|
427
|
|
|
|
|
428
|
|
|
$this->components->info('Trait classes scaffolding generated successfully.'); |
|
429
|
|
|
} |
|
430
|
|
|
|
|
431
|
|
|
protected function handleConfigPath() |
|
432
|
|
|
{ |
|
433
|
|
|
if (! is_dir($directory = base_path('config'))) { |
|
434
|
|
|
mkdir($directory, 0755, true); |
|
435
|
|
|
} |
|
436
|
|
|
|
|
437
|
|
|
$filesystem = new Filesystem; |
|
438
|
|
|
|
|
439
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/config')) |
|
|
|
|
|
|
440
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
441
|
|
|
$filesystem->copy( |
|
442
|
|
|
$file->getPathname(), |
|
443
|
|
|
base_path('config/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
444
|
|
|
); |
|
445
|
|
|
}); |
|
446
|
|
|
|
|
447
|
|
|
$this->components->info('config files scaffolding generated successfully.'); |
|
448
|
|
|
} |
|
449
|
|
|
|
|
450
|
|
|
protected function handleDatabasePath() |
|
451
|
|
|
{ |
|
452
|
|
|
if (! is_dir($directory = base_path('database/factories'))) { |
|
453
|
|
|
mkdir($directory, 0755, true); |
|
454
|
|
|
} |
|
455
|
|
|
|
|
456
|
|
|
if (! is_dir($directory = base_path('database/migrations'))) { |
|
457
|
|
|
mkdir($directory, 0755, true); |
|
458
|
|
|
} |
|
459
|
|
|
|
|
460
|
|
|
$filesystem = new Filesystem; |
|
461
|
|
|
|
|
462
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/database/factories')) |
|
|
|
|
|
|
463
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
464
|
|
|
$filesystem->copy( |
|
465
|
|
|
$file->getPathname(), |
|
466
|
|
|
base_path('database/factories/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
467
|
|
|
); |
|
468
|
|
|
}); |
|
469
|
|
|
|
|
470
|
|
|
$this->components->info('database/factories files scaffolding generated successfully.'); |
|
471
|
|
|
|
|
472
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/database/migrations')) |
|
473
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
474
|
|
|
$filesystem->copy( |
|
475
|
|
|
$file->getPathname(), |
|
476
|
|
|
base_path('database/migrations/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
477
|
|
|
); |
|
478
|
|
|
}); |
|
479
|
|
|
|
|
480
|
|
|
$this->components->info('database/migrations files scaffolding generated successfully.'); |
|
481
|
|
|
} |
|
482
|
|
|
|
|
483
|
|
|
protected function handleLangPath() |
|
484
|
|
|
{ |
|
485
|
|
|
if (! is_dir($directory = base_path('lang/en'))) { |
|
486
|
|
|
mkdir($directory, 0755, true); |
|
487
|
|
|
} |
|
488
|
|
|
|
|
489
|
|
|
$filesystem = new Filesystem; |
|
490
|
|
|
|
|
491
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/lang/en')) |
|
|
|
|
|
|
492
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
493
|
|
|
$filesystem->copy( |
|
494
|
|
|
$file->getPathname(), |
|
495
|
|
|
base_path('lang/en/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
496
|
|
|
); |
|
497
|
|
|
}); |
|
498
|
|
|
|
|
499
|
|
|
$this->components->info('lang/en files scaffolding generated successfully.'); |
|
500
|
|
|
} |
|
501
|
|
|
|
|
502
|
|
|
protected function handleRoutesPath() |
|
503
|
|
|
{ |
|
504
|
|
|
|
|
505
|
|
|
if (! is_dir($directory = base_path('routes/app'))) { |
|
506
|
|
|
mkdir($directory, 0755, true); |
|
507
|
|
|
} |
|
508
|
|
|
|
|
509
|
|
|
$filesystem = new Filesystem; |
|
510
|
|
|
|
|
511
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/routes/app')) |
|
|
|
|
|
|
512
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
513
|
|
|
$filesystem->copy( |
|
514
|
|
|
$file->getPathname(), |
|
515
|
|
|
base_path('routes/app/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
516
|
|
|
); |
|
517
|
|
|
}); |
|
518
|
|
|
|
|
519
|
|
|
$this->components->info('routes/app files scaffolding generated successfully.'); |
|
520
|
|
|
|
|
521
|
|
|
file_put_contents( |
|
522
|
|
|
base_path('routes/web.php'), |
|
523
|
|
|
file_get_contents(__DIR__.'/stubs/init/routes/web.stub'), |
|
524
|
|
|
FILE_APPEND |
|
525
|
|
|
); |
|
526
|
|
|
|
|
527
|
|
|
file_put_contents( |
|
528
|
|
|
base_path('routes/api.php'), |
|
529
|
|
|
file_get_contents(__DIR__.'/stubs/init/routes/api.stub'), |
|
530
|
|
|
FILE_APPEND |
|
531
|
|
|
); |
|
532
|
|
|
|
|
533
|
|
|
$this->components->info('routes scaffolding generated successfully.'); |
|
534
|
|
|
} |
|
535
|
|
|
|
|
536
|
|
|
protected function handleTestsPath() |
|
537
|
|
|
{ |
|
538
|
|
|
if (! is_dir($directory = base_path('tests/Feature'))) { |
|
539
|
|
|
mkdir($directory, 0755, true); |
|
540
|
|
|
} |
|
541
|
|
|
|
|
542
|
|
|
$filesystem = new Filesystem; |
|
543
|
|
|
|
|
544
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/tests/Feature')) |
|
|
|
|
|
|
545
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
546
|
|
|
$filesystem->copy( |
|
547
|
|
|
$file->getPathname(), |
|
548
|
|
|
base_path('tests/Feature/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
549
|
|
|
); |
|
550
|
|
|
}); |
|
551
|
|
|
|
|
552
|
|
|
$this->components->info('tests/Feature files scaffolding generated successfully.'); |
|
553
|
|
|
} |
|
554
|
|
|
|
|
555
|
|
|
protected function handleResourcesPath() |
|
556
|
|
|
{ |
|
557
|
|
|
if (! is_dir($directory = base_path('resources/views/layouts'))) { |
|
558
|
|
|
mkdir($directory, 0755, true); |
|
559
|
|
|
} |
|
560
|
|
|
|
|
561
|
|
|
if (! is_dir($directory = base_path('resources/views/passwords'))) { |
|
562
|
|
|
mkdir($directory, 0755, true); |
|
563
|
|
|
} |
|
564
|
|
|
|
|
565
|
|
|
if (! is_dir($directory = base_path('resources/views/socialite'))) { |
|
566
|
|
|
mkdir($directory, 0755, true); |
|
567
|
|
|
} |
|
568
|
|
|
|
|
569
|
|
|
if (! is_dir($directory = base_path('resources/views/twofactor'))) { |
|
570
|
|
|
mkdir($directory, 0755, true); |
|
571
|
|
|
} |
|
572
|
|
|
|
|
573
|
|
|
$filesystem = new Filesystem; |
|
574
|
|
|
|
|
575
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/resources/views/layouts')) |
|
|
|
|
|
|
576
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
577
|
|
|
$filesystem->copy( |
|
578
|
|
|
$file->getPathname(), |
|
579
|
|
|
base_path('resources/views/layouts/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
580
|
|
|
); |
|
581
|
|
|
}); |
|
582
|
|
|
|
|
583
|
|
|
$this->components->info('resources/views/layouts files scaffolding generated successfully.'); |
|
584
|
|
|
|
|
585
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/resources/views/passwords')) |
|
586
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
587
|
|
|
$filesystem->copy( |
|
588
|
|
|
$file->getPathname(), |
|
589
|
|
|
base_path('resources/views/passwords/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
590
|
|
|
); |
|
591
|
|
|
}); |
|
592
|
|
|
|
|
593
|
|
|
$this->components->info('resources/views/passwords files scaffolding generated successfully.'); |
|
594
|
|
|
|
|
595
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/resources/views/socialite')) |
|
596
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
597
|
|
|
$filesystem->copy( |
|
598
|
|
|
$file->getPathname(), |
|
599
|
|
|
base_path('resources/views/socialite/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
600
|
|
|
); |
|
601
|
|
|
}); |
|
602
|
|
|
|
|
603
|
|
|
$this->components->info('resources/views/socialite files scaffolding generated successfully.'); |
|
604
|
|
|
|
|
605
|
|
|
collect($filesystem->allFiles(__DIR__.'/stubs/init/resources/views/twofactor')) |
|
606
|
|
|
->each(function (SplFileInfo $file) use ($filesystem) { |
|
607
|
|
|
$filesystem->copy( |
|
608
|
|
|
$file->getPathname(), |
|
609
|
|
|
base_path('resources/views/twofactor/'.Str::replaceLast('.stub', '.php', $file->getFilename())) |
|
610
|
|
|
); |
|
611
|
|
|
}); |
|
612
|
|
|
|
|
613
|
|
|
$this->components->info('resources/views/twofactor files scaffolding generated successfully.'); |
|
614
|
|
|
} |
|
615
|
|
|
} |
|
616
|
|
|
|