Skip to content

Commit dae23e6

Browse files
committed
Fixes a bug with the enum parser
1 parent 7dab11a commit dae23e6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Commands/CreateMigrationCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ protected function getEnumParams(Field $field)
437437
throw new Exception('The field type is not enum! Cannot create an enum column with no options.');
438438
}
439439

440-
$values = array_filter($field->getOptionsByLang(), function ($option) {
440+
$values = array_filter($field->getOptionsByLang(), function ($option) use ($field) {
441441
return ! ($field->isRequired() && $option->value == '');
442442
});
443443

@@ -446,7 +446,7 @@ protected function getEnumParams(Field $field)
446446
'It is possible that this field is required but only have option available has an empty string.');
447447
}
448448

449-
return sprintf('[%s]', implode(',', Helpers::wrapItems($values)));
449+
return sprintf('[%s]', implode(',', Helpers::wrapItems( array_column($values, 'value') )));
450450
}
451451

452452
/**

0 commit comments

Comments
 (0)