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

[5.6] Include $columns in getCountForPagination call #23209

Closed
wants to merge 1 commit into from
Closed

[5.6] Include $columns in getCountForPagination call #23209

wants to merge 1 commit into from

Conversation

mauro-baptista
Copy link

This PR intends to include the $columns variable in all calls of getCountForPagination.

Currently it is already passed on Illuminate/Database/Query/Builder.php, but it is not on Illuminate/Database/Eloquent/Builder.php, in both cases it is used when paginating an model.

Problem:

  • Wrong total being returned from the paginate method

When Issue was found:

  • I'm building a search page for an eCommerce, and it has multiple relationships. When I try to get the paginate, it returns the wrong total, since Laravel needs that $columns to be passed into the getCountForPagination to a count into a distinct column, instead of the default '*'.

Note: I would be good to update the version 5.5 as well, since it affects old versions.

@devcircus
Copy link
Contributor

Check this link. This has been tried many times.

@mauro-baptista
Copy link
Author

Shit! I will already search for a workaround instead!

Thanks for your message!

Even tough would be good to know which other cases it change would brake

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.

3 participants