What your UserCollection looks like?
Apr 14, 2018
4
Level 5
How to add pagination meta when combining Collection with Resource in API Resource
Hi there all !
Building a API in here and using the new API Resource options.
However I need this to work:
$users = User::paginate(10);
return new UserCollection(UserResource::collection($users));
This will not include any meta or links data for that pagination. However if I run:
$users = User::paginate(10);
return new UserCollection($users);
It does include meta data for the pagination, but that way I cant modify the resources. Seems pretty simple but cant find a working solution so far.
Please or to participate in this conversation.