However, it sounds so basic that Laravel should be handling it by default. But turns out Laravel does not pass the GET URL parameters to the pagination links by default, and there is an extra method you have to use to make sure that all the pagination URL contains the required URL Parameters.

Here is how you can pass all the URL parameters to the links

$users->appends(request()->input())->links();

appends method can accept an array as the parameter and you can also pass in a single parameter something as

$users->appends('user_id' => request()->get('user_id'))->links();

If there is a hash parameter that needs to be sent along you can use the fragment parameter.

<?php echo $users->fragment('foo')->render(); ?>
Comments