| @@ 293-313 (lines=21) @@ | ||
| 290 | $stub = $this->files->get($stub); |
|
| 291 | $replaces = []; |
|
| 292 | ||
| 293 | if ($file === 'form') { |
|
| 294 | $columns = $this->getModelFillableColumns( |
|
| 295 | $this->getNamespacedModel($this->argument('model')), |
|
| 296 | true |
|
| 297 | ); |
|
| 298 | $html = ''; |
|
| 299 | ||
| 300 | foreach ($columns as $column) { |
|
| 301 | $html .= str_replace([ |
|
| 302 | '{{ column }}', '{{ model }}', '{{ variable }}' |
|
| 303 | ], [ |
|
| 304 | $column, $name, Str::singular($name) |
|
| 305 | ], $this->files->get( |
|
| 306 | $this->resolveStubPath('/stubs/views/form-input.stub') |
|
| 307 | )); |
|
| 308 | } |
|
| 309 | ||
| 310 | $replaces = [ |
|
| 311 | '{{ columns }}' => $html |
|
| 312 | ]; |
|
| 313 | } |
|
| 314 | ||
| 315 | if ($file === 'table') { |
|
| 316 | $columns = $this->getModelFillableColumns( |
|
| @@ 315-334 (lines=20) @@ | ||
| 312 | ]; |
|
| 313 | } |
|
| 314 | ||
| 315 | if ($file === 'table') { |
|
| 316 | $columns = $this->getModelFillableColumns( |
|
| 317 | $this->getNamespacedModel($this->argument('model')) |
|
| 318 | ); |
|
| 319 | $html = ''; |
|
| 320 | ||
| 321 | foreach ($columns as $column) { |
|
| 322 | $html .= str_replace([ |
|
| 323 | '{{ column }}', '{{ model }}', '{{ variable }}' |
|
| 324 | ], [ |
|
| 325 | $column, $name, Str::singular($name) |
|
| 326 | ], $this->files->get( |
|
| 327 | $this->resolveStubPath('/stubs/views/table-column.stub') |
|
| 328 | )); |
|
| 329 | } |
|
| 330 | ||
| 331 | $replaces = [ |
|
| 332 | '{{ columns }}' => $html |
|
| 333 | ]; |
|
| 334 | } |
|
| 335 | ||
| 336 | return str_replace(array_keys($replaces), array_values($replaces), $stub); |
|
| 337 | } |
|