You can eager load nested relations - I assumed the Project has one Status???
return Activity::with('project.status','type')->paginate(25);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello all, I want to query four tables using Eloquent: status, type, activity, project. One project has many activities and one status, and every activity has one type. Using relationships I can query three of them, activity, project and type.
return Activity::with('project','type')->paginate(25);
But I want to know the status of the project. How can I do that with Eloquent? Thanks in advance.
You can eager load nested relations - I assumed the Project has one Status???
return Activity::with('project.status','type')->paginate(25);
Please or to participate in this conversation.