Eloquent relationships explained visually
Every Eloquent relationship type โ what it looks like on disk, where it goes wrong, and when it's the right call. Written from the perspective of someone who's debugged enough of them.
Eloquent makes it easy to declare a relationship in one line. It makes it harder to undo one. Every method you reach for โ hasMany, belongsToMany, morphTo โ locks in a real shape your database has to support and a query pattern you'll be paying off for years.
We've spent the last year building a tool that draws these relationships, which means we've also spent the last year debugging them. This is a visual reference for every type โ what it looks like on disk, where it tends to go wrong, and when it's actually the right call.