| @@ 162-183 (lines=22) @@ | ||
| 159 | /** |
|
| 160 | * |
|
| 161 | */ |
|
| 162 | protected function exportControllers() |
|
| 163 | { |
|
| 164 | if ($this->option('fake')) { |
|
| 165 | $path = $this->stubs['controllers']; |
|
| 166 | $baseDir = new vfsStreamDirectory('app'); |
|
| 167 | vfsStream::copyFromFileSystem($path, $baseDir); |
|
| 168 | return true; |
|
| 169 | } |
|
| 170 | ||
| 171 | foreach ($this->controllers as $key => $value) { |
|
| 172 | if (file_exists(app_path('Http/Controllers/Api/v1/'.$value)) && ! $this->option('force')) { |
|
| 173 | if (! $this->confirm("The [{$value}] already exists. Do you want to replace it?")) { |
|
| 174 | continue; |
|
| 175 | } |
|
| 176 | } |
|
| 177 | ||
| 178 | copy( |
|
| 179 | base_path('stubs/Controllers/'.$key), |
|
| 180 | app_path('Http/Controllers/Api/v1/'.$value) |
|
| 181 | ); |
|
| 182 | } |
|
| 183 | } |
|
| 184 | ||
| 185 | /** |
|
| 186 | * |
|
| @@ 188-209 (lines=22) @@ | ||
| 185 | /** |
|
| 186 | * |
|
| 187 | */ |
|
| 188 | protected function exportModels() |
|
| 189 | { |
|
| 190 | if ($this->option('fake')) { |
|
| 191 | $path = $this->stubs['models']; |
|
| 192 | $baseDir = new vfsStreamDirectory('app'); |
|
| 193 | vfsStream::copyFromFileSystem($path, $baseDir); |
|
| 194 | return true; |
|
| 195 | } |
|
| 196 | ||
| 197 | foreach ($this->models as $key => $value) { |
|
| 198 | if (file_exists(app_path('Models/'.$value)) && ! $this->option('force')) { |
|
| 199 | if (! $this->confirm("The [{$value}] model already exists. Do you want to replace it?")) { |
|
| 200 | continue; |
|
| 201 | } |
|
| 202 | } |
|
| 203 | ||
| 204 | copy( |
|
| 205 | base_path('stubs/Models/'.$key), |
|
| 206 | app_path('Models/'.$value) |
|
| 207 | ); |
|
| 208 | } |
|
| 209 | } |
|
| 210 | ||
| 211 | /** |
|
| 212 | * |
|
| @@ 241-262 (lines=22) @@ | ||
| 238 | /** |
|
| 239 | * |
|
| 240 | */ |
|
| 241 | protected function exportSeeds() |
|
| 242 | { |
|
| 243 | if ($this->option('fake')) { |
|
| 244 | $path = $this->stubs['seeds']; |
|
| 245 | $baseDir = new vfsStreamDirectory('app'); |
|
| 246 | vfsStream::copyFromFileSystem($path, $baseDir); |
|
| 247 | return true; |
|
| 248 | } |
|
| 249 | ||
| 250 | foreach ($this->seeds as $key => $value) { |
|
| 251 | if (file_exists(database_path('seeds/'.$value)) && ! $this->option('force')) { |
|
| 252 | if (! $this->confirm("The [{$value}] already exists. Do you want to replace it?")) { |
|
| 253 | continue; |
|
| 254 | } |
|
| 255 | } |
|
| 256 | ||
| 257 | copy( |
|
| 258 | base_path('stubs/seeds/'.$key), |
|
| 259 | database_path('seeds/'.$value) |
|
| 260 | ); |
|
| 261 | } |
|
| 262 | } |
|
| 263 | ||
| 264 | /** |
|
| 265 | * @param $src |
|