| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function getEnumPresetValues(string $table, string $columnName): ?string |
||
| 16 | { |
||
| 17 | /** @var MigrationGeneratorSetting $setting */ |
||
| 18 | $setting = app(MigrationGeneratorSetting::class); |
||
| 19 | |||
| 20 | $column = DB::connection($setting->getConnection())->select("SHOW COLUMNS FROM `${table}` where Field = '${columnName}' AND Type LIKE 'enum(%'"); |
||
| 21 | if (count($column) > 0) { |
||
| 22 | return substr( |
||
| 23 | str_replace('enum(', '[', $column[0]->Type), |
||
| 24 | 0, |
||
| 25 | -1 |
||
| 26 | ).']'; |
||
| 27 | } |
||
| 28 | return null; |
||
| 29 | } |
||
| 30 | |||
| 48 |