How can I make my page paginated so that it shows 10 records/page. I have done this in Laravel but not sure how to do it in Lumen
Paginate is available in Lumen. You will do just the same as in Laravel. Here is the documentation: http://laravel.com/docs/5.1/pagination#basic-usage
I have 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);
To limit the number of results returned from the query, or to skip a given number of results in the query (OFFSET), you may 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With