Aug 9, 2022
0
Level 5
enum or accessor
Hello,
I am a bit confused and would like some help deciding what to use.
I have a table called products that has 2 fields: publish and in_stock
Both fields are either true or false.
When displaying the fields to the user I would like to display: Published or Not published for the publish field
In Stock or Out of Stock for the in_stock field
When coding I would like to check if the product is published or not, if it's in stock or not e.g.:
if($product->publish) {
do something
} else {
do something else
}
What should I use here? enum? accessor?
What should be the field type? enum? varchar? boolean? tinyint?
I can't decide what to use.
Thank you
Please or to participate in this conversation.