Support the ongoing development of Laravel.io →
Database Eloquent Architecture

I have an application that's getting pretty large. I've noticed that one of our tables "locations" is doing the job of several tables. There are many sub-locations that inherit the same properties, but are different enough that they justify their own table (because of additional fields).

I've also noticed I need to apply this pattern to another part of my application so it's definitely a pattern worth learning how to do and implementing.

Problem is I don't see any documentation on this type of Eloquent feature. Is single and multiple class inheritance out of scope of the Eloquent ORM? I'm working on implementing the repository pattern, so I could possibly switch out to doctrine which I know supports this. I'd just rather stick with Eloquent because it's so easy to use. Has anyone else encountered this problem?

Last updated 2 years ago.
0

Found a great solution using polymorphic relationships

http://richardbagshaw.co.uk/blog/laravel-user-types-and-polymorphic-relationships/

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.