我用url中的perPage和页面发送我的请求。那是
url = users?page=0&perPage=10 //the get http url
所以我想对我模型请求进行分页,比如并指定页面和perPage
User::paginate()
因此,在文档中,我看到我可以添加perPage,但我不知道如何添加页面。在laravel documentation中,我看到您可以像这样添加perPage
User::paginate($request->get('perPage')) //perPage from url request
但是,现在如何将页面参数添加到分页,以便可以指定类似于0的页面值
HOw我要继续吗?
我还检查了This question,但它没有显示如何在雄辩的模型分页中设置它
发布于 2019-06-10 03:40:55
来自官方文档
the current page is detected by the value of the page query string argument on the HTTP request.
Laravel自动处理它。所以你不需要做什么。
发布于 2019-06-10 04:16:14
使用->appends()
方法
$users = User::paginate($request->get('perPage'));
$users->appends($request->all());
https://stackoverflow.com/questions/56517666
复制相似问题