Random characters are added to pagination links in laravel 5.2

I have a little problem, please take a look.

I showed some data on a page based on some filtering conditions. Everything works well except Pagination. I cannot correctly add filter parameters to page links. I get these parameters through the post method. when I add these parameters to pagination links, some rendom attributes are automatically added.

ex: $paginateQuerypara = array('search_type'=>'filter', 'category_id'=>'1', 'city_id'=>'1', 'min_price'=>'10',  'max_price'=>'1000');

ex: {!! $productArr->appends([$paginateQuerypara])->links() !!}

o/p pagination link: http://example.com/public/filter?0%5Bsearch_type%5D=filter&0%5Bcategory_id%5D=1&0%5Bcity_id%5D=3&0%5Bmin_price%5D=1&0%5Bmax_price%5D=10000&page=2

this is my page url which is of some random nature. I want to get rid of them like 0% 5B , % 5D . I can’t add parameters statically, because there are many such parameters, so I want to make them dynamic.

Thanks in advance.

+4
source share
1 answer

try changing

{!! $productArr->appends([$paginateQuerypara])->links() !!}

to

{!! $productArr->appends($paginateQuerypara)->links() !!}

$paginateQuerypara- an array. You pass it in appends(), wrapped in another array.

+5
source

Source: https://habr.com/ru/post/1651817/


All Articles