laravel-cross-eloquent-search
laravel-cross-eloquent-search copied to clipboard
Retain querystring values during pagination
Hello, I love this package so much, it does not play nice with pagination options like withQueryString()
This worked as a temporary solution
$data = new \Illuminate\Pagination\LengthAwarePaginator( $data->getCollection(), $data->total(), $data->perPage(), $data->currentPage(), [ 'path' => request()->url(), 'query' => $request->query() ] );
where $data is the result from Search::new()->add(...
I Think this is the same Issue as this one posted to the Laravel-Ide-Helper Project.
https://github.com/barryvdh/laravel-ide-helper/issues/1144
I don't understand the problem. Could you give an example so I can reproduce the problem?
This solution worked for me:
$results->appends($request->query());
Here is a link to the documentation: https://laravel.com/docs/9.x/pagination#appending-query-string-values.