laravel - Limiting laravel pagination center to 3
问题描述
I'm having trouble in my pagination because i have to many data in my database. I want to limit or reduce the display in pagination center for it didn't fit in mobile sizes. The image below display 5 pagination in center. i want to make it 3. I am using laravel 6 ang latest bootstrap.
here is my code
解决方案
从文档中:
您可以控制在分页器的 URL“窗口”的每一侧显示多少附加链接。默认情况下,三个链接显示在主分页器链接的每一侧。但是,您可以使用以下
onEachSide
方法控制此数字:
{{ $users->onEachSide(5)->links() }}
因此,在您的情况下,您需要onEachSide(1)
获得三个链接。
推荐阅读
- asp.net-mvc - mvc view 分享时显示预览(Facebook、whatsapp、Twitter)
- r - 读取文本文件
- javascript - 在同意之前禁用 cookie
- c++ - 如何知道指针是否已在其他地方释放
- sql-server - SQL Server:从另一个表中获取值,进行计算并保存到表中
- image-processing - 简单的圆检测模型
- reactjs - mobx 计算的 getter 永远不会被评估
- java - ExpressionVisitor接口的Olingo visitLambdaExpression的实现
- azure-devops - EDITBIN 在 Microsoft 托管代理中的位置
- mysql - Django 按日期分组,SUM 值包括 SUM 零