我有2個表格:帖子和評論。發佈和評論具有一對多的關係。我無法評估laravel 4分頁鏈接
我設法用下面的代碼來評估職位paginations和評論:下面
$posts = Post::with(array(
'comments' => function($c) {
$c->paginate(5);
}))
->paginate(10);
第一行給出了$帖子的鏈接,但第二個沒有。
{{ $posts->links() }}
{{ $post->comments->links() }}
它提供了以下錯誤:
Call to undefined method Illuminate\Database\Eloquent\Collection::links()
如何評估的每個帖子的評論鏈接?
注意:{{$ post-> comments}}給出指定帖子的評論。
這不起作用:它給出以下錯誤:ErrorException 調用未定義的方法Illuminate \ Database \ Query \ Builder :: links() – horse