enum DayOfWeek {
case Monday;
case Tuesday;
case Wednesday;
case Thursday;
case Friday;
case Saturday;
case Sunday;
}
$table->enum('day_of_week', array_map(fn($day) => $day->name, DayOfWeek::cases()));
enum DayOfWeek {
case Monday;
case Tuesday;
case Wednesday;
case Thursday;
case Friday;
case Saturday;
case Sunday;
}
$table->enum('day_of_week', array_column(DayOfWeek::cases(), 'name'));
2条答案
按热度按时间h43kikqp1#
我还不确定
$table->enum
是否实现了枚举,但是您可以这样做;3b6akqbq2#