User and Profile tables

Ricardo Faria posted 2 months ago

Hi guys. I'm developing a social network for training laravel and i have doubts about how I should organize my models. This is a "basic" question but i want to linten some opinions. I need to have fields like: First and Last name, email, password; Ok, this fields are in User model. Now, I need to have fields like "user picture", "date of birth", "Genre", "Country", "City", "phone number"...

My question is, how should i organize fields? For example, should i create a Profile model? And what kind of fields are on this table? For example, picture, i'm sure that this field should be in Profile table. But for example, date of birth? Where should it be? Country? City?


Cameron replied 2 months ago

I ended up making an address model to store city , state , address , zip_code and address_type to take care of shipping / vs billing . I also made a UserMeta model to store other info about the user. I do think you should keep avatar in the default user model because there are some nice “handy features “ later on you may want to use

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us