User model handling two separate database tables

Posted 4 months ago by BlastedAsh

So initially I had one User model and one UserController work with my database table 'Users'.

Due to how I refactored my database schema on paper I have something that looks like this : https://drive.google.com/open?id=1Sc3wi_l_1JNe66uQ65_xEWHLDpkO5TsX

Before, everything that was in my meta_users was in my users table. I added foreign key constraints on meta_users for user_id being linked to the users->id.

My question is, do I have to create a new separate model "meta_users" and then tie it in with my User model. Or can I just use the User model to work with both tables.

For example, before my registration page would input and mass assign all the fields into my User table. But with my new configuration, it would mass assign some fields into Users and some into Meta_users. What would be the best way to do this?

Thanks :)

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.