Level 50
When I need pagination on relationship I do it like this
$orders = $user->orders()->paginate();
Using this query:
$user->load(['orders' => function ($query) {
$query->with(['product:id,name'])->withTrashed()->latest();
}]);
I would like to use a paginator for the retrieved orders.
How to do so? I know there's
$user->setRelation('orders', relation_query_here);
Any suggestions?
Please or to participate in this conversation.