Support the ongoing development of Laravel.io →
Database Eloquent

I'm sure this is a basic question, but I have the following:

Model "A" which has many of "B", which in turn has many of "C", which in turn has many of "D".

Thanks to Eloquent, I can easily do $this->hasManyThrough('C', 'B') within A, and get all "C"s through A->c();

Can I do something similar to get all Ds through A? If not, what would be the best way of accomplishing this? I'm guessing it would be through Query Builder, but I don't know where to begin.

Thanks for any help!

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

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.