@@ -117,35 +117,48 @@ 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 ->compileStub ( ' controllers/HomeController ' ));
121
121
}
122
122
} 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
+ );
124
141
}
125
142
126
143
file_put_contents (
127
144
base_path ('routes/web.php ' ),
128
145
file_get_contents (__DIR__ .'/Auth/stubs/routes.stub ' ),
129
146
FILE_APPEND
130
147
);
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
- );
136
148
}
137
149
138
150
/**
139
- * Compiles the "HomeController" stub.
151
+ * Compiles the given stub.
140
152
*
153
+ * @param string $stub
141
154
* @return string
142
155
*/
143
- protected function compileControllerStub ( )
156
+ protected function compileStub ( $ stub )
144
157
{
145
158
return str_replace (
146
159
'{{namespace}} ' ,
147
160
$ this ->laravel ->getNamespace (),
148
- file_get_contents (__DIR__ .'/Auth/stubs/controllers/HomeController .stub ' )
161
+ file_get_contents (__DIR__ .'/Auth/stubs/ ' . $ stub . ' .stub ' )
149
162
);
150
163
}
151
164
0 commit comments