framework: Paginate method doesn't work if key contains array notation
- Laravel Version: 5.4
- PHP Version: 7.1
Description:
If pagination key is of array notation (ie. page[published], page[unpublished]) when on ?page[published]=5 the value is not taken into consideration (it still displays first page)
Steps To Reproduce:
- Paginate given dataset using
paginate(10, ['*'], 'page[published]') - Display given dataset on view using
links() - Go to one of the urls generated by the pagination
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 21 (13 by maintainers)
You pass
page.publishedtopaginatemethod.PageResolverwill use it ininputmethod onrequestto retrieve current page.inputmethod is working with dot notation, that is why we passpage.publishedhere. So, we createdPaginatorwithpage.publishedpageName. If we will uselinksmethod on such paginator, it creates smth likepage.published=2which is not what we want. So, we change its name topage[published]for correct link generation. Does it make sense now? 😃You can override the page resolver using
AbstractPaginator::currentPageResolver(), then add in support yourself. That would at least means you can support it in your own application even if it is not to be supported in the framework.