Skip to content
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

Fix limit perPage in Eloquent simplePaginate function #41383

Closed
wants to merge 1 commit into from

Conversation

Farhan25
Copy link

@Farhan25 Farhan25 commented Mar 7, 2022

Limit value should be the same as perPage, this small issue is not critical since the offset is right and limit is only 1 more than it should be, but it's right to fix if that's the case

This a scenario of the issue:
For example,
It retrieve first 11 records (1 --> 11) in page = 1 and perpage = 10 but it should retrieve only the first 10 (1 --> 10).
It retrieve 11 records (10 --> 21) in page = 2 and perpage = 10 but it should retrieve only the first 10 (10 --> 20).
Notice that row #11 is retrieved twice.

Notes:

  1. The output is fine somehow, but I have discovered this issue when I used DB::enableQueryLog() and DB::getQueryLog().
  2. This fix DOES another bug, causing the value of next_page_url to be null, I've tried to investigate it more but it seems that I lost in it.

limit value should be the same as `perPage`, this small issue is not critical since the offset is right and limit is only 1 more than it should be, but it's right to fix if that's the case
@taylorotwell
Copy link
Member

I am closing this pull request because it lacks sufficient explanation, tests, or both. It is difficult for us to merge pull requests without these things because the change may introduce breaking changes to the framework.

Feel free to re-submit your change with a thorough explanation of the feature and tests - integration tests are preferred over unit tests. Please include it's benefit to end users; the reasons it does not break any existing features; how it makes building web applications easier, etc.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants