Have you look at polymorphic relations on eloquent?
INSERT record in Supertype/Subtype tables
I have this schema.

My employees and customers share the same users table. A user can be either an employee or a customer.
How do I INSERT a user record and also make sure to insert in the right (subtype) table which in this case can be employees or customers?
-
Implement logic in Eloquent Models? like (for example inserting an employee record): Insert values into users; Check the user_type; If
user_type = empthen insert the specific values intoemployeestable; -
Use MYSQL triggers, stored procedures? (I am not very familiar with them)
What about when my employees could also have subtypes associated to them and need extra fields in different tables (employee_types: sales, acquisitions, managers, etc)?
Please or to participate in this conversation.