@@ -117,35 +117,48 @@ protected function exportBackend()
117117
118118 if (file_exists ($ controller ) && ! $ this ->option ('force ' )) {
119119 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 ->compileStub ( ' controllers/HomeController ' ));
121121 }
122122 } else {
123- file_put_contents ($ controller , $ this ->compileControllerStub ());
123+ file_put_contents ($ controller , $ this ->compileStub ('controllers/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 ->compileStub ('controllers/Controller ' ));
131+ }
132+ } else {
133+ file_put_contents ($ baseController , $ this ->compileStub ('controllers/Controller ' ));
134+ }
135+
136+ if (! file_exists (database_path ('migrations/0001_01_01_000000_create_users_table.php ' ))) {
137+ copy (
138+ __DIR__ .'/../stubs/migrations/2014_10_12_100000_create_password_resets_table.php ' ,
139+ base_path ('database/migrations/2014_10_12_100000_create_password_resets_table.php ' )
140+ );
124141 }
125142
126143 file_put_contents (
127144 base_path ('routes/web.php ' ),
128145 file_get_contents (__DIR__ .'/Auth/stubs/routes.stub ' ),
129146 FILE_APPEND
130147 );
131-
132- copy (
133- __DIR__ .'/../stubs/migrations/2014_10_12_100000_create_password_resets_table.php ' ,
134- base_path ('database/migrations/2014_10_12_100000_create_password_resets_table.php ' )
135- );
136148 }
137149
138150 /**
139- * Compiles the "HomeController" stub.
151+ * Compiles the given stub.
140152 *
153+ * @param string $stub
141154 * @return string
142155 */
143- protected function compileControllerStub ( )
156+ protected function compileStub ( $ stub )
144157 {
145158 return str_replace (
146159 '{{namespace}} ' ,
147160 $ this ->laravel ->getNamespace (),
148- file_get_contents (__DIR__ .'/Auth/stubs/controllers/HomeController .stub ' )
161+ file_get_contents (__DIR__ .'/Auth/stubs/ ' . $ stub . ' .stub ' )
149162 );
150163 }
151164
0 commit comments