if this worked, then
Room::with('recipients.messages')->find(1);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a three tables.
Room(id) Recipient(id, room_id, message_id) Message(id)
Room : Recipient -> one to many
Message : Recipient -> one to many
I want Message row from Room instance.
first, I try this code
App\Room::find(1)->recipients()->message()
but didn't work . error code is "no HasMany fun"
how can I get my message row?
Please or to participate in this conversation.