Fix limit perPage in Eloquent simplePaginate function #41383
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 caseThis a scenario of the issue:
For example,
It retrieve first 11 records (1 --> 11) in
page = 1
andperpage = 10
but it should retrieve only the first 10 (1 --> 10).It retrieve 11 records (10 --> 21) in
page = 2
andperpage = 10
but it should retrieve only the first 10 (10 --> 20).Notice that row #11 is retrieved twice.
Notes:
DB::enableQueryLog()
andDB::getQueryLog()
.next_page_url
to be null, I've tried to investigate it more but it seems that I lost in it.