| Conditions | 2 |
| Paths | 2 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function execute($request) |
||
| 18 | { |
||
| 19 | $model = ucfirst($request['name']); |
||
| 20 | $table = Str::plural(Str::snake($model)); |
||
| 21 | $stub = __DIR__ . '/../../../resources/stubs/migration/model.stub'; |
||
| 22 | $this->filename = 'database/migrations/' |
||
| 23 | . date('Y_m_d_His') |
||
| 24 | . "_create_{$table}_table.php"; |
||
| 25 | |||
| 26 | if(! File::isDirectory(dirname(base_path($this->filename)))){ |
||
| 27 | File::makeDirectory(dirname(base_path($this->filename)), 0777, true, true); |
||
| 28 | } |
||
| 29 | |||
| 30 | File::put(base_path($this->filename), str_replace([ |
||
| 31 | '$classname$', |
||
| 32 | '$table$', |
||
| 33 | '$columns$' |
||
| 34 | ], [ |
||
| 35 | 'Create' . Str::plural($model) . 'Table', |
||
| 36 | $table, |
||
| 37 | rtrim($this->getColumns($request)) |
||
| 38 | ], File::get($stub))); |
||
| 39 | } |
||
| 40 | |||
| 58 |