Hello and thanks for your help. I've done some research and tried a few options but can't seem get this to work properly. I'm passing a URL with a query string into a function that loads the page via URL passed. However, I'm trying to find a way to paginate the results as well. Is there a way I can pass the query string url to Laravel's pagination links? Thanks.
My URL with query string
<a id="searchData"class="btn btn-primary ml-1 mr-5 text-light" title="Search" type="submit"
onclick="ajaxLoad('{{url('dma/data')}}?startDate='+$('#startDate').val()+'&endDate='+$('#endDate').val()
+ '&dmaNameFilter=' + encodeURI(dma_name) + '&memberNameFilter=' + encodeURI(member_name))">Search Results
</a>
I tried this for the links():
{{ $data->appends(request()->query())->links() }}
I have this in my Controller:
$data = Report::where('CallDate', '>=', $start_date)->where('CallDate', '<=', $end_date)->paginate(13)->appends(request()->query());
request()->query()
is an array with startDate/endDate / dmaNameFilter / memberNameFilter, your pagination links in blade is OK. But it seems incorrect in the controller which I think you should add more where conditions for the query, e.g. dmaNameFilter, memberNameFilter,... – Phil