1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Acacha\AdminLTETemplateLaravel\Console; |
4
|
|
|
|
5
|
|
|
use Illuminate\Console\Command; |
6
|
|
|
use Illuminate\Filesystem\Filesystem; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class PublishAdminLTE. |
10
|
|
|
*/ |
11
|
|
|
class PublishAdminLTE extends Command |
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
use Installable; |
15
|
|
|
/** |
16
|
|
|
* The filesystem instance. |
17
|
|
|
* |
18
|
|
|
* @var \Illuminate\Filesystem\Filesystem |
19
|
|
|
*/ |
20
|
|
|
protected $files; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* The name and signature of the console command. |
24
|
|
|
*/ |
25
|
|
|
protected $signature = 'adminlte-laravel:publish {--f|force : Force overwrite of files}'; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* The console command description. |
29
|
|
|
* |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
protected $description = 'Publish Acacha AdminLTE Template files into laravel project'; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Force overwrite of files. |
36
|
|
|
* |
37
|
|
|
* @var bool |
38
|
|
|
*/ |
39
|
|
|
protected $force = false; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Create a new command instance. |
43
|
|
|
* |
44
|
|
|
* @param \Illuminate\Filesystem\Filesystem $files |
45
|
|
|
* |
46
|
|
|
* @return void |
|
|
|
|
47
|
|
|
*/ |
48
|
|
|
public function __construct(Filesystem $files) |
49
|
|
|
{ |
50
|
|
|
parent::__construct(); |
51
|
|
|
$this->files = $files; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Execute the console command. |
56
|
|
|
*/ |
57
|
|
View Code Duplication |
public function handle() |
|
|
|
|
58
|
|
|
{ |
59
|
|
|
$this->processOptions(); |
60
|
|
|
$this->publishHomeController(); |
61
|
|
|
$this->changeRegisterController(); |
62
|
|
|
$this->changeLoginController(); |
63
|
|
|
$this->changeForgotPasswordController(); |
64
|
|
|
$this->changeResetPasswordController(); |
65
|
|
|
$this->publishPublicAssets(); |
66
|
|
|
$this->publishViews(); |
67
|
|
|
$this->publishResourceAssets(); |
68
|
|
|
$this->publishTests(); |
69
|
|
|
$this->publishLanguages(); |
70
|
|
|
$this->publishGravatar(); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Install Home Controller. |
75
|
|
|
*/ |
76
|
|
|
private function publishHomeController() |
77
|
|
|
{ |
78
|
|
|
$this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::homeController()); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Change Auth Register controller. |
83
|
|
|
*/ |
84
|
|
|
private function changeRegisterController() |
85
|
|
|
{ |
86
|
|
|
$this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::registerController()); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Change Auth Login controller. |
91
|
|
|
*/ |
92
|
|
|
private function changeLoginController() |
93
|
|
|
{ |
94
|
|
|
$this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::loginController()); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Change Auth Forgot Password controller. |
99
|
|
|
*/ |
100
|
|
|
private function changeForgotPasswordController() |
101
|
|
|
{ |
102
|
|
|
$this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::forgotPasswordController()); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Change Auth Reset Password controller. |
107
|
|
|
*/ |
108
|
|
|
private function changeResetPasswordController() |
109
|
|
|
{ |
110
|
|
|
$this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::resetPasswordController()); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Install public assets. |
115
|
|
|
*/ |
116
|
|
|
private function publishPublicAssets() |
117
|
|
|
{ |
118
|
|
|
$this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::publicAssets()); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Install views. |
123
|
|
|
*/ |
124
|
|
|
private function publishViews() |
125
|
|
|
{ |
126
|
|
|
$this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::viewsToOverwrite()); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Install resource assets. |
131
|
|
|
*/ |
132
|
|
|
private function publishResourceAssets() |
133
|
|
|
{ |
134
|
|
|
$this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::resourceAssets()); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Install resource assets. |
139
|
|
|
*/ |
140
|
|
|
private function publishTests() |
141
|
|
|
{ |
142
|
|
|
$this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::tests()); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Install language assets. |
147
|
|
|
*/ |
148
|
|
|
private function publishLanguages() |
149
|
|
|
{ |
150
|
|
|
$this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::languages()); |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Install gravatar config file. |
155
|
|
|
*/ |
156
|
|
|
private function publishGravatar() |
157
|
|
|
{ |
158
|
|
|
$this->install(\Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::gravatar()); |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* Process options before running command. |
163
|
|
|
*/ |
164
|
|
|
private function processOptions() |
165
|
|
|
{ |
166
|
|
|
$this->force = $this->option('force'); |
|
|
|
|
167
|
|
|
} |
168
|
|
|
} |
169
|
|
|
|
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.