@@ -117,20 +117,33 @@ protected function exportBackend()
117
117
118
118
if (file_exists ($ controller ) && ! $ this ->option ('force ' )) {
119
119
if ($ this ->components ->confirm ("The [HomeController.php] file already exists. Do you want to replace it? " )) {
120
- file_put_contents ($ controller , $ this ->compileControllerStub ( ' HomeController ' ));
120
+ file_put_contents ($ controller , $ this ->compileStub ( ' controllers/ HomeController ' ));
121
121
}
122
122
} else {
123
- file_put_contents ($ controller , $ this ->compileControllerStub ( ' HomeController ' ));
123
+ file_put_contents ($ controller , $ this ->compileStub ( ' controllers/ HomeController ' ));
124
124
}
125
125
126
126
$ baseController = app_path ('Http/Controllers/Controller.php ' );
127
127
128
128
if (file_exists ($ baseController ) && ! $ this ->option ('force ' )) {
129
129
if ($ this ->components ->confirm ("The [Controller.php] file already exists. Do you want to replace it? " )) {
130
- file_put_contents ($ baseController , $ this ->compileControllerStub ( ' Controller ' ));
130
+ file_put_contents ($ baseController , $ this ->compileStub ( ' controllers/ Controller ' ));
131
131
}
132
132
} else {
133
- file_put_contents ($ baseController , $ this ->compileControllerStub ('Controller ' ));
133
+ file_put_contents ($ baseController , $ this ->compileStub ('controllers/Controller ' ));
134
+ }
135
+
136
+ if (class_exists ('Illuminate\Auth\Middleware\RedirectIfAuthenticated ' )
137
+ && method_exists ('Illuminate\Auth\Middleware\RedirectIfAuthenticated ' , 'redirectUsing ' )) {
138
+ $ appProvider = app_path ('Providers/AppServiceProvider.php ' );
139
+
140
+ if (file_exists ($ appProvider ) && ! $ this ->option ('force ' )) {
141
+ if ($ this ->components ->confirm ("The [AppServiceProvider.php] file already exists. Do you want to replace it? " )) {
142
+ file_put_contents ($ appProvider , $ this ->compileStub ('providers/AppServiceProvider ' ));
143
+ }
144
+ } else {
145
+ file_put_contents ($ appProvider , $ this ->compileStub ('providers/AppServiceProvider ' ));
146
+ }
134
147
}
135
148
136
149
file_put_contents (
@@ -151,12 +164,12 @@ protected function exportBackend()
151
164
* @param string $stub
152
165
* @return string
153
166
*/
154
- protected function compileControllerStub ($ stub )
167
+ protected function compileStub ($ stub )
155
168
{
156
169
return str_replace (
157
170
'{{namespace}} ' ,
158
171
$ this ->laravel ->getNamespace (),
159
- file_get_contents (__DIR__ .'/Auth/stubs/controllers/ ' .$ stub .'.stub ' )
172
+ file_get_contents (__DIR__ .'/Auth/stubs/ ' .$ stub .'.stub ' )
160
173
);
161
174
}
162
175
0 commit comments