-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Request] Add methods to Paginator::make() which will return "current" items #26
Comments
Wouldn't it better to slice the data coming out of Mongo instead of letting the Paginator do it? |
There's the method |
My initial reason behind not paginating straight ouf of Mongo was although we would only display the top X results, we need the the other results for graphing the data. So we display the top 50 results based on a column value, but we need all results in order to graph over time (since the top 50 can be from any time period). To reduce the queries (granted it's negligible between 1 and 2) and also reduce the amount of reusable math in my controllers, it would be helpful (but obviously not necessary) to have those methods available. I don't really have a problem keeping it as it is, but just a thought I had while working with it. |
I would suggest just slicing it and passing it into the paginator. |
Update Application.php
From my understanding of the Paginator class right now, when you want to use make() to paginate custom data not from Eloquent (in my case it's from Mongo), it doesn't actually handle returning the subset of data to be displayed on the current page.
Current code:
Wanted code:
Then in the view:
Currently
getItems()
just returns the items you put into the first argument ofmake()
, so probably addgetRows()
or something similar to get the data which would just be anarray_slice()
call or similar.Thoughts? Am I missing something in the current functionality?
The text was updated successfully, but these errors were encountered: