Best way to populate Field (like ENUM)

Hello, i’ve a table that has some “hard coded option” like ENUM()… I’m wondering where is the best way to store it

Like the fields:
gender: array(‘Male’, ‘Female’);
eyes_color: array(‘Black’,‘Green’,‘Blue’,‘Brown’);
body: array(‘Fat’,‘Skinny’,‘Ok’);

I don’t want to code it in the views… Where is the best place and how?

Tks

Not a cake reference but you will get the idea: https://laracasts.com/discuss/channels/general-discussion/laravel-enum?page=1

Me I avoid enum, instead use things like a checkbox, or radio buttons. And as you know a checkbox is tinyint in MySql. 0 is false and 1 is true, so I just store a 1 or 0 as needed.

But radio works very well for things like male, female, and choices where user can only pick one.

1 Like