aarondfrancis / fast-paginate

A fast implementation of offset/limit pagination for Laravel.
MIT License
1.21k stars 56 forks source link

FastPaginate on collection aggregation #53

Closed MagnusDot closed 1 year ago

MagnusDot commented 1 year ago

on our project, we would like to use this library completely but we are doing collection aggregation and currently you don't support this, is it possible to do this? or should we continue using paginate() for collections?

MagnusDot commented 1 year ago

image i've got this type of errors

aarondfrancis commented 1 year ago

It doesn't make sense to fastPaginate a collection, since you've already got all the records. There isn't even a paginate method on a collection, so I don't think there should be a fastPaginate.

aarondfrancis commented 1 year ago

See also https://github.com/hammerstonedev/fast-paginate/issues/23

MagnusDot commented 1 year ago

Hello @aarondfrancis , thank you for your quick answer, but there is indeed a paginate method on the collections currently

image image

MagnusDot commented 1 year ago

but you are right that there is no need for fastpaginate as the requests have already been made, thank you for your time and sorry for the stupid question

aarondfrancis commented 1 year ago

Hmm that's weird. I'm looking in the source code and I'm not seeing a paginate method. Maybe a package is adding it?

image image

Is there any way you could point me to the collection paginate method?

sorry for the stupid question

Not a stupid question!

MagnusDot commented 1 year ago

after some research, i found that it was a macro created by spatie lavavel livewire wizard that added the pagination on the collections like this

aarondfrancis commented 1 year ago

Ah ha! I wondered where that was coming from. Thank you for reporting back!