Hi, I need to populate an enum field with three values enum('low', 'medium', 'hight'). I'm using Faker and Factories in Laravel 5.3, how can I do to populate using the Factory with one of those values?
Just that different databases do different things with them and it's easy to get trapped or encounter difficult to spot bugs. So in mysql prior to the new 5.7 (and depending on the config of 5.7) you can do :
create table enums (statuses enum('ok', 'error'));
insert into enums values('ok');
insert into enums values('hellokitty');
select * from enums;
| statuses |
+----------+
| ok |
| |
5.7 is a little different, another database is different to that, etc. I think it's just given programmers a feeling of safety where-as it's a bit more error-prone.