I have a a group
instance I want to eager load with pagination:
public function show(Group $group)
{
$group = $group->with('members);
return$ group
}
I want to return group
with members
paginated.
I have a a group
instance I want to eager load with pagination:
public function show(Group $group)
{
$group = $group->with('members);
return$ group
}
I want to return group
with members
paginated.
You can do that but it's not recommended because using paginate for eager loaded relationships generates two repeated queries
Use
setRelation()
and lazy loading: