Level 60
Assuming you have Post Comment and Rating Models, and relationships between
Post::with(['comments', 'ratings'])->get();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i have three tables posts, ratings and comments just want to get all the comments and ratings of first post in single API route
Assuming you have Post Comment and Rating Models, and relationships between
Post::with(['comments', 'ratings'])->get();
Please or to participate in this conversation.