0

Code in this function is executed by ajax call. I have pagination like this:

{
    $id=$_GET['data'];
    User::where('votes', '>', $id)->paginate(15);
}

It works fine on the first page, however on the second page it does not find the $_GET['data']. How can I organize the pagination in this case? Do I have to overwrite the pagination for this case to enable an extra GET parameter pass to that? Thanks much in advance :)

Alice
  • 9
  • 2

1 Answers1

0

In your view, you will have something like this to show the pagination:

{!! $users->links() !!}

To pass your other parameters with it, you should change it into:

{!! $users->appends(Request::only('data))->links() !!}
RW24
  • 624
  • 2
  • 10
  • 19