Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Rretzko's avatar
Level 15

Best Practice: Extends vs. One-to-one relationship

Hi - I'm looking for guidance on Eloquent Best Practice for using/avoiding extending models.

Example: three models: Student, Teacher, Parent.

Each is a User and each has common properties: first/last name, address, email, phone.

I've placed these common properties into a Person model.

Address, Email and Phone are separate models and coded as one-to-many or many-to-many relationships.

First_name and Last_name are one-to-one relationships as are the User properties.

Question: Should User->Person->Student, User->Person->Teacher and User->Person->Parent be defined as one-to-one relationships using HasOne()/BelongsTo() methods or simply extended as in traditional OOP structure?

Thanks for your thoughts!

0 likes
2 replies
jeffreyvanrossum's avatar
Level 9

I would say that inheritance would make sense in this case. And if other attributes are needed for a specific child, you could implement that through a relation to keep the users table clean.

But I'm interested in what others think. Maybe it would depend on how you plan to interact with these entities?

Rretzko's avatar
Level 15

Thanks for the response, JeffreyVanRossum! This didn't seem to generate much interest, which leads me to believe that it isn't a hot-topic and likely folks stay with the default one-to-one/many relationships.

1 like

Please or to participate in this conversation.