1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PWWEB\Artomator\Commands\Publish; |
4
|
|
|
|
5
|
|
|
use InfyOm\Generator\Commands\Publish\PublishBaseCommand; |
6
|
|
|
|
7
|
|
|
class PublishTemplateCommand extends PublishBaseCommand |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* The console command name. |
11
|
|
|
* |
12
|
|
|
* @var string |
13
|
|
|
*/ |
14
|
|
|
protected $name = 'artomator.publish:templates'; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* The console command description. |
18
|
|
|
* |
19
|
|
|
* @var string |
20
|
|
|
*/ |
21
|
|
|
protected $description = 'Publishes artomator generator templates.'; |
22
|
|
|
|
23
|
|
|
private $templatesDir; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Execute the command. |
27
|
|
|
*/ |
28
|
|
|
public function handle() |
29
|
|
|
{ |
30
|
|
|
$this->templatesDir = config( |
31
|
|
|
'infyom.laravel_generator.path.templates_dir', |
32
|
|
|
resource_path('infyom/infyom-generator-templates/') |
33
|
|
|
); |
34
|
|
|
|
35
|
|
|
if ($this->publishGeneratorTemplates()) { |
36
|
|
|
$this->publishScaffoldTemplates(); |
37
|
|
|
$this->publishSwaggerTemplates(); |
38
|
|
|
} |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Publishes templates. |
43
|
|
|
*/ |
44
|
|
|
public function publishGeneratorTemplates() |
45
|
|
|
{ |
46
|
|
|
$templatesPath = __DIR__.'/../../../../../infyomlabs/laravel-generator/templates'; |
47
|
|
|
|
48
|
|
|
$this->publishDirectory($templatesPath, $this->templatesDir, 'infyom-generator-templates'); |
49
|
|
|
|
50
|
|
|
$templatesPath = __DIR__.'/../../../templates'; |
51
|
|
|
|
52
|
|
|
return $this->publishDirectory($templatesPath, $this->templatesDir, 'pwweb-artomator-templates'); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Publishes scaffold stemplates. |
57
|
|
|
*/ |
58
|
|
|
public function publishScaffoldTemplates() |
59
|
|
|
{ |
60
|
|
|
$templateType = config('infyom.laravel_generator.templates', 'adminlte-templates'); |
61
|
|
|
|
62
|
|
|
$templatesPath = base_path('vendor/infyomlabs/'.$templateType.'/templates/scaffold'); |
63
|
|
|
|
64
|
|
|
return $this->publishDirectory($templatesPath, $this->templatesDir.'scaffold', 'infyom-generator-templates/scaffold', true); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Publishes swagger stemplates. |
69
|
|
|
*/ |
70
|
|
|
public function publishSwaggerTemplates() |
71
|
|
|
{ |
72
|
|
|
$templatesPath = base_path('vendor/infyomlabs/swagger-generator/templates'); |
73
|
|
|
|
74
|
|
|
return $this->publishDirectory($templatesPath, $this->templatesDir, 'swagger-generator', true); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Get the console command options. |
79
|
|
|
* |
80
|
|
|
* @return array |
81
|
|
|
*/ |
82
|
|
|
public function getOptions() |
83
|
|
|
{ |
84
|
|
|
return []; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Get the console command arguments. |
89
|
|
|
* |
90
|
|
|
* @return array |
91
|
|
|
*/ |
92
|
|
|
protected function getArguments() |
93
|
|
|
{ |
94
|
|
|
return []; |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
|