Closed robsontenorio closed 7 years ago
@robsontenorio Hi and thanks for your proposal. I am examining :)
@robsontenorio Hi again, I fixed pagination issue. Your proposal is cool but I can't use directly. Because this package is using several operator other than "=" (eg: <=, != etc.)
So, I fixed this issue by adding new Paginator class that extends from LengthAwarePaginator.
You can check this out https://github.com/selahattinunlu/laravel-api-query-builder/commit/73ffd510556283086fd8c961bb2f7d9d45e95ab7
I'm working on "appends" idea now. I will release new version after complete it. I will inform you on here.
Finally, @tttwb I'm so sorry for late. I did not get any notification about your issue from Github :|
@robsontenorio @tttwb
I released new version. 💯 👍 You can use it after composer update
.
https://github.com/selahattinunlu/laravel-api-query-builder/releases/tag/v1.5.0
Improving: add original query string on paginate() method
Problem The current paginate() method does not includes the original query parameters on "url pages"
http://localhost:8025/app/public/users?includes=city&country=US&limit=10&page=4 results ...
Proposal
Now "next_page_url" and "prev_page_url" includes the original query string
Supporting dynamic appends() on Laravel models
Static way On Laravel models we have "$appends = ['is_admin', 'balance']" attribute that allow us to add some custom attributes to our model.
Dynamic way
$user = User::find(1)->append(['is_admin', 'balance']);
Full solution : fixing query string on paginate() and adding support to dynamic append()
NOTE: The same append() logic would be applied on get() method (except "query string" issue).