Laravel pagination with query string

With pagination it is sometimes necessary to add query parameters to the pagination links.

The following PHP code for Laravel will automatically produce the links for you.

{{ $posts->appends(request()->query())->links() }}

See: https://github.com/laravel/framework/issues/19441


Explore our projects