如何在 Lumen 中应用分页?

How to apply pagination in Lumen?

如何让我的页面分页以显示 10 records/page。我在 Laravel 中完成了此操作,但不确定如何在 Lumen

中执行此操作

分页在 Lumen 中可用。您将执行与 Laravel 中相同的操作。这是文档:http://laravel.com/docs/5.1/pagination#basic-usage

我自己在 Lumen 版本 5 中使用过它,我可以告诉你它的工作原理是一样的。

例如。 $users = DB::table('posts')->paginate(10);

跳过/拿

要限制查询返回的结果数,或跳过查询中给定数量的结果 (OFFSET),您可以使用 skiptake 方法:

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

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