Support the ongoing development of →
Database Eloquent
Last updated 1 year ago.

Try this:

$templatedata = $user->posts()->with('replies')->get();

The $templatedata will be a Collection of Post objects each having a property ->replies which will contain a Collection of Reply objects.

Last updated 1 year ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.