Eloquent query with pagination

Posted 2 years ago by ekrist1

I have implementet query string filtering using the laracast session (https://laracasts.com/series/eloquent-techniques/episodes/4).

I´m able to add pagination to the result, but how can I add pagination together with the query string? Now the next_url shows http://laravel.dev/api/getcontacts?page=2 regardless your have a query string like: http://laravel.dev/api/getcontacts?keyword=t

Getcontact controller:

  $contacts = Contact::filter($filters)->paginate(2);

   return response()->json($contacts);

Query string code: https://github.com/laracasts/Dedicated-Query-String-Filtering

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.