Conditions | 1 |
Paths | 1 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | public function execute($request) |
||
16 | { |
||
17 | $model = ucfirst($request['name']); |
||
18 | $table = Str::plural(Str::snake($model)); |
||
19 | $stub = __DIR__ . '/../../resources/stubs/migration.stub'; |
||
20 | $filename = 'database/migrations/' . date('Y_m_d_His') . "_create_{$table}_table.php"; |
||
21 | $columns = RuleParser::rulesToMigrationColumns($request['fields']); |
||
22 | |||
23 | File::put(base_path($filename), str_replace( |
||
24 | ['$classname$', '$table$', '$columns$'], |
||
25 | ['Create' . Str::plural($model) . 'Table', $table, $columns], |
||
26 | File::get($stub) |
||
27 | )); |
||
28 | } |
||
29 | } |
||
30 |