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

Method \Unlu\Laravel\Api\QueryBuilder::paginate() does not work #52

Open
BlackMaizeGod opened this issue Jun 29, 2023 · 0 comments
Open

Comments

@BlackMaizeGod
Copy link

BlackMaizeGod commented Jun 29, 2023

Hi there,
Your library is a perfect solution for resolving search criteria via URI, but it has some bugs.

Preconditions:

  • PHP 8.2
  • slim/slim-skeleton
  • illuminate/database
  • illuminate/http
  • illuminate/pagination
  • illuminate/validation
  • robmorgan/phinx
  • unlu/laravel-api-query-builder

Issues:

  • Query without indicating parameters returns error:

image

  • Paginator object, retrieved from Method \Unlu\Laravel\Api\QueryBuilder::paginate() contains incorrect items:

image

image

@BlackMaizeGod BlackMaizeGod changed the title Method \Unlu\Laravel\Api\QueryBuilder::paginate() does nto works Method \Unlu\Laravel\Api\QueryBuilder::paginate() does not work Jun 29, 2023
BlackMaizeGod pushed a commit to BlackMaizeGod/laravel-api-query-builder that referenced this issue Jun 29, 2023
- Changed return value from null to empty string in `UriParser::setQueryUri` method, if query params were not pass. It needs, so that `Paginator::setQueryUri` str_replace get empty string instead of `null` and does not crash.
BlackMaizeGod pushed a commit to BlackMaizeGod/laravel-api-query-builder that referenced this issue Jun 29, 2023
- Added additional step for identification current page before processing pagination query in the `QueryBuilder::basePaginate` method. It needs, because the `QueryBuilder::basePaginate`  is private and is called only once and only in this class. The method calls without `$page` parameter passing, so that the `$page` will always be `1` and the `Paginator::items` will have incorrect items.
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

No branches or pull requests

1 participant