@@ -117,10 +117,20 @@ 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 ());
120
+ file_put_contents ($ controller , $ this ->compileControllerStub (' HomeController ' ));
121
121
}
122
122
} else {
123
- file_put_contents ($ controller , $ this ->compileControllerStub ());
123
+ file_put_contents ($ controller , $ this ->compileControllerStub ('HomeController ' ));
124
+ }
125
+
126
+ $ baseController = app_path ('Http/Controllers/Controller.php ' );
127
+
128
+ if (file_exists ($ baseController ) && ! $ this ->option ('force ' )) {
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 ' ));
131
+ }
132
+ } else {
133
+ file_put_contents ($ baseController , $ this ->compileControllerStub ('Controller ' ));
124
134
}
125
135
126
136
file_put_contents (
@@ -138,14 +148,15 @@ protected function exportBackend()
138
148
/**
139
149
* Compiles the "HomeController" stub.
140
150
*
151
+ * @param string $stub
141
152
* @return string
142
153
*/
143
- protected function compileControllerStub ()
154
+ protected function compileControllerStub ($ stub )
144
155
{
145
156
return str_replace (
146
157
'{{namespace}} ' ,
147
158
$ this ->laravel ->getNamespace (),
148
- file_get_contents (__DIR__ .'/Auth/stubs/controllers/HomeController .stub ' )
159
+ file_get_contents (__DIR__ .'/Auth/stubs/controllers/ ' . $ stub . ' .stub ' )
149
160
);
150
161
}
151
162
0 commit comments