How to apply pagination in Lumen?

How to make your page paginated so that it displays 10 records / pages. I did it in Laravel, but not sure how to do it in Lumen

+5
source share
2 answers

Paginate is available at Lumen. You will do the same as in Laravel. Here is the documentation: http://laravel.com/docs/5.1/pagination#basic-usage

I myself used it in version 5 of Lumen, and I can tell you that it works the same.

ex. $users = DB::table('posts')->paginate(10);

+7
source

skip / accept

To limit the number of results returned from a query, or to skip a certain number of results in a query ( OFFSET ), you can use the skip and take methods:

 $users = DB::table('users')->skip(10)->take(5)->get(); 

Source: https://laravel.com/docs/5.1/queries#ordering-grouping-limit-and-offset

0
source

All Articles