By default Laravel’s paginator does not follow the query strings when it’s generating URLs. It can be an issue when we perform a search and append the keywords in the query string, but the next page’s URL removes it entirely. With this snippet, you can extend the paginator’s URL and make your browsing fluent.
// Example link: posts?key=value&page=2 $paginator->append(['key' => 'value'])->links();