- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
函数 simplePaginate()
在直接调用 where()
函数后开始工作:
$posts = $userA->Posts()->simplePaginate(10)->get();
User Eloquent 中的 Posts() 函数:
public function Posts(){
return Post::where('user_id','$this->id')->where('category','programming');
}
目前一切正常,但问题是当我有多个用户时,所以我做了这个:
//Creating Empty Collection (Working Without any problem)
$posts = new \Illuminate\Database\Eloquent\Collection;
//Getting and Adding the userA Posts (Working Without any problem)
$userA_Posts = $userA->Posts();
$posts = $posts->merge($userA_Posts);
//Getting and Adding the userB Posts (Working Without any problem)
$userB_Posts = $userB->Posts();
$posts = $posts->merge($userB_Posts);
//Getting and Adding the userC Posts (Working Without any problem)
$userC_Posts = $userC->Posts();
$posts = $posts->merge($userC_Posts);
//Here Laravel Shows me an ERROR {Method simplePaginate does not exist}
$posts = $posts->sortByDesc('created_at')->simplePaginate(10)->values()->all();
//I changed it to this, ERROR {Method simplePaginate does not exist}
$posts = $posts->sortByDesc('created_at')->values()->simplePaginate(10)->all();
//I changed it to this, ERROR {Method simplePaginate does not exist}
$posts = $posts->sortByDesc('created_at')->values()->all()->simplePaginate(10);
In the laravel Documentation I didn't find the
simplePaginate()
Function But it's working after thewhere()
Function , So please Help
最佳答案
你必须删除->get()
,只留下->simplePaginate(10);
关于php - Laravel 5 - SimplePaginate 函数在这里不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39555052/
如何使用 simplePagination.js jQuery plugin与服务器端?我的页面(不是表格)加载了很多 div,并且我正在对这些“div”进行分页。但是,在某些情况下,我会分页很多内容
我正在尝试使用 simplePagination在我的代码上。 (我正在使用 MVC4 C# 进行开发) 假设我有这一堆代码
函数 simplePaginate() 在直接调用 where() 函数后开始工作: $posts = $userA->Posts()->simplePaginate(10)->get(); User
函数 simplePaginate() 在直接调用 where() 函数后开始工作: $posts = $userA->Posts()->simplePaginate(10)->get(); User
我已经按照作者页面的说明进行操作: http://flaviusmatis.github.io/simplePagination.js/ 从这里: How to use SimplePaginatio
这是我的 html 和 php 代码: One
var search; var searchdiv = $("#searchdiv"); var perPage = 3; searchdiv.pagination({ itemsOnPage:
PAGINATION DEMO 我正在使用handlebars.js 和 simplePagination.js 开发分页 数据从 JSON 加载并使用handlebars.js 显示 现在我必须将
使用表单在 header.php 文件中创建 MySQL 数据库的 php 搜索。尝试将 simplePagination.js 与 php 一起使用。我能够正确计算结果数量并显示适当数量的页面链接。
我是一名优秀的程序员,十分优秀!