Level 60
try this
Room::with('recipients.messages')->get()';
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have three tables.
Room table (id) Recipient table(id, room_id(foreign key), user_id(foreign key)) Message table(id)
I want to access Message table from Room table
I already know Room->Recipient (HasMany)
but I don't know Room->Recipient->Message
Thank you for looking at my question.
try this
Room::with('recipients.messages')->get()';
Please or to participate in this conversation.