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

mohammadHs's avatar

how to get objects from relation of relation in laravel

I have 3 model: Course,group,student

I want to give students from Course with 2 relations.

for ex: I want students of Course 1 (id=1)

The Course has Many group(5,6,8) and each group have One(36,38) or Many(35,37) students

How to get all students of Course with relations and eloquent

0 likes
2 replies

Please or to participate in this conversation.