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