| @@ 137-158 (lines=22) @@ | ||
| 134 | /** |
|
| 135 | * |
|
| 136 | */ |
|
| 137 | protected function exportControllers() |
|
| 138 | { |
|
| 139 | if ($this->option('fake')) { |
|
| 140 | $path = $this->stubs['controllers']; |
|
| 141 | $baseDir = new vfsStreamDirectory('app'); |
|
| 142 | vfsStream::copyFromFileSystem($path, $baseDir); |
|
| 143 | return true; |
|
| 144 | } |
|
| 145 | ||
| 146 | foreach ($this->controllers as $key => $value) { |
|
| 147 | if (file_exists(app_path('Http/Controllers/Api/v1/'.$value)) && ! $this->option('force')) { |
|
| 148 | if (! $this->confirm("The [{$value}] already exists. Do you want to replace it?")) { |
|
| 149 | continue; |
|
| 150 | } |
|
| 151 | } |
|
| 152 | ||
| 153 | copy( |
|
| 154 | base_path('stubs/Controllers/'.$key), |
|
| 155 | app_path('Http/Controllers/Api/v1/'.$value) |
|
| 156 | ); |
|
| 157 | } |
|
| 158 | } |
|
| 159 | ||
| 160 | /** |
|
| 161 | * |
|
| @@ 163-184 (lines=22) @@ | ||
| 160 | /** |
|
| 161 | * |
|
| 162 | */ |
|
| 163 | protected function exportModels() |
|
| 164 | { |
|
| 165 | if ($this->option('fake')) { |
|
| 166 | $path = $this->stubs['models']; |
|
| 167 | $baseDir = new vfsStreamDirectory('app'); |
|
| 168 | vfsStream::copyFromFileSystem($path, $baseDir); |
|
| 169 | return true; |
|
| 170 | } |
|
| 171 | ||
| 172 | foreach ($this->models as $key => $value) { |
|
| 173 | if (file_exists(app_path('Models/'.$value)) && ! $this->option('force')) { |
|
| 174 | if (! $this->confirm("The [{$value}] model already exists. Do you want to replace it?")) { |
|
| 175 | continue; |
|
| 176 | } |
|
| 177 | } |
|
| 178 | ||
| 179 | copy( |
|
| 180 | base_path('stubs/Models/'.$key), |
|
| 181 | app_path('Models/'.$value) |
|
| 182 | ); |
|
| 183 | } |
|
| 184 | } |
|
| 185 | ||
| 186 | /** |
|
| 187 | * |
|
| @@ 216-237 (lines=22) @@ | ||
| 213 | /** |
|
| 214 | * |
|
| 215 | */ |
|
| 216 | protected function exportSeeds() |
|
| 217 | { |
|
| 218 | if ($this->option('fake')) { |
|
| 219 | $path = $this->stubs['seeds']; |
|
| 220 | $baseDir = new vfsStreamDirectory('app'); |
|
| 221 | vfsStream::copyFromFileSystem($path, $baseDir); |
|
| 222 | return true; |
|
| 223 | } |
|
| 224 | ||
| 225 | foreach ($this->seeds as $key => $value) { |
|
| 226 | if (file_exists(database_path('seeds/'.$value)) && ! $this->option('force')) { |
|
| 227 | if (! $this->confirm("The [{$value}] already exists. Do you want to replace it?")) { |
|
| 228 | continue; |
|
| 229 | } |
|
| 230 | } |
|
| 231 | ||
| 232 | copy( |
|
| 233 | base_path('stubs/seeds/'.$key), |
|
| 234 | database_path('seeds/'.$value) |
|
| 235 | ); |
|
| 236 | } |
|
| 237 | } |
|
| 238 | ||
| 239 | /** |
|
| 240 | * @param $src |
|