lundi 13 novembre 2017

Laravel Paginator's "append"

I'm using Laravel 5.5 with PHP 7.0.

I am trying to create pagination following the docs.

http://ift.tt/2hxX4xy

However with some queries which have multiple values, rendered links has different keys.

Simplest reproducing code is:

>>> User::query()->paginate(30)->appends(['a' => ['foo', 'bar', 'baz']])->nextPageUrl()
=> "http://ift.tt/2jntBqr"
# expecting "http://ift.tt/2hv4eT6"

In other words, the next url of /user?page=1&id[]=1&id[]=2 should be:

/user?page=2&id[]=1&id[]=2

but actually

/user?page=2&id[0]=1&id[1]=2

What is wrong in my code?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hr8PCk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire