Answer the question
In order to leave comments, you need to log in
Laravel pagination. Breaks sorting through get parameters. How to win?
Laravel 5.8.
Made filtering products through get-requests of the form:
?1=дуб,ясень&15=3&7=лак,масло
When you go to any other page (pagination), the get-request breaks and turns into:
?0=дуб,ясень&1=3&2=лак,масло&page=2
That is, the first parameter is equal to zero, and each next one is simply increased by one.
I render pagination like this:
{{ $products->appends(request()->input())->links('layouts.pagination') }}
Answer the question
In order to leave comments, you need to log in
Here
$products->links('layouts.pagination')->withQueryString()
in controller
...
$products = $xxx->paginate(15)->appends(request()->query());
...
{{ $products->links('layouts.pagination') }}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question