You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Paginator, currently pageName can only be a "first-level" query parameter. Some Spechs (i.e. JSON:API) require pagination query parameters to reside under or within the page parameter. This might look like ?page[size]=5&page[number]=3 or page[cursor]=123. Currently this seems not to be possible with Laravel.
Using the string 'page[number]' as pageName results in a query string with doubled parameter page%5Bnumber%5D.
The reason for this lies in Illuminate\Pagination\AbstractPaginator::url() where $parameters is filled with:
// i.E. the next_page URL
[
// from $pageName 'page[number]' => 4, // next// from query'page' => [
'number' => 3, // current
],
],
Neither Arr::query() nor http_build_query() handle this conflicting situation properly.
A simple solution would be, to normalize / flatten the $parameters array before array_merge() in the url() method. Not sure if this would cause any other issues.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In Paginator, currently
pageName
can only be a "first-level" query parameter. Some Spechs (i.e. JSON:API) require pagination query parameters to reside under or within thepage
parameter. This might look like?page[size]=5&page[number]=3
orpage[cursor]=123
. Currently this seems not to be possible with Laravel.Using the string
'page[number]'
as pageName results in a query string with doubled parameterpage%5Bnumber%5D
.The reason for this lies in
Illuminate\Pagination\AbstractPaginator::url()
where $parameters is filled with:Neither
Arr::query()
norhttp_build_query()
handle this conflicting situation properly.A simple solution would be, to normalize / flatten the $parameters array before
array_merge()
in theurl()
method. Not sure if this would cause any other issues.Beta Was this translation helpful? Give feedback.
All reactions