selahattinunlu / laravel-api-query-builder

Laravel & Lumen Api Query Builder Package
332 stars 66 forks source link

Previous and next page urls in pagination response #9

Closed willbrowningme closed 7 years ago

willbrowningme commented 7 years ago

When making a query to an end point that returns all the data for the current user if there are no filters but then only returns a subset with filters applied e.g:

http://example.com/api/orders?status=completed&dispatched=1&date_from=01-10-2016&date_to=01-11-2016&page=1

The response pagination data for the next and previous pages do not include any of the filters from the original request, so if using these to change page it will return all the data with no filters.

{
  "data": {
    "total": 100,
    "per_page": 15,
    "current_page": 2,
    "last_page": 7,
    "next_page_url": "http://example.com/api/orders?page=3",
    "prev_page_url": "http://example.com/api/orders?page=1",
    "from": 16,
    "to": 30,
    "data": [.....]
  }
}

Is there a way to make the next_page_url and prev_page_url include all the same filters with simply the page = 2 etc?

robsontenorio commented 7 years ago

@tttwb See #12 Waiting for @selahattinunlu answer.

selahattinunlu commented 7 years ago

Pagination issue is fixed.

@tttwb I want to say again, I'm so sorry for late.