jaeyson's avatar

inserting some data in a pagination

Hi! is it possible to add data in pagination without using LengthAwarePaginator? data is an array of strings and i'd add it randomly per page

0 likes
9 replies
tykus's avatar

What kind of data do you need to add? And what type of response are you returning; a Resource Collection will allow you to modify the meta data if yours is a JSON API?

tykus's avatar

@jaeyson and why does this additional data need to be appended to the Paginator instance, or are you appending data to the items within the Paginator (which can be achieved using the through method)?

jaeyson's avatar

@Sinnbeck an array of strings. sorry for the incomplete details, updated my question above

Sinnbeck's avatar

@jaeyson So an array of strings on each item ? I assume this data is based on the item itself? Can you perhaps give an example?

jaeyson's avatar

@tykus im planning to insert this data randomly in a paginator. but if fiddling with LengthAwarePaginator be the only way then ill mark this as solved. I wanted to ask some advice.

tykus's avatar

@jaeyson I honestly don't understand what you're trying to achieve to insert this data randomly in a paginator - so it is difficult to advise!

Please or to participate in this conversation.