如何对模型关系进行分页?
我利用hasmany
查询到了用户发布的文章,但是不知道如何对查出的数据进行分页。
user.php
public function posts (){
return $this->hasMany('App\Post');
}
controller
$posts= Auth::user()->posts;
这个是一个 collection,我不知道该怎么分页。
希望有解决的方案。
@柚子男 感谢,成功了!