Hi all. I want to create api for chat application. Every chat has users and messages relation. I wanna create Resource API for GET /chat/ that will return all chats with auth()->user(). But i wanna have pagination for this chats. And this chat has relation that call as messages, and i wanna have pagination for messages too. Like a inner pagination. Structure of this will be the next:
If you have a route that returns 10 conversations for the authenticated user, how are you expecting to paginate the messages for the first conversation?
Instead, have a route that returns conversations for a user:
Thanks for your reply. I can create another route to fetch paginated messages, but i want to attouch this paginated route to to conversation paginate. Like:
Conversations// paginated
[
{
...,
Messages // paginated with another route
[]
}
]
I need to grab 10 conversations with 10 messages for all conversations. After that lazy load messages using paginator for messages)