php Paginate on hasMany系列

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Paginate on hasMany系列相关的知识,希望对你有一定的参考价值。


https://laracasts.com/discuss/channels/laravel/how-to-paginate-eloquent-hasmany-relation

User::find(122)->sites->paginate() ;  // will not work because it is trying to access
              a method of site property
User::find(122)->sites()->paginate();  // works, needs to be to be enclosed in parenthesis


$user_history = User::find( Auth::id() )->uservideos->paginate(20);  //Will not work
$user_history = User::find( Auth::id() )->uservideos()->paginate(20); // OK

以上是关于php Paginate on hasMany系列的主要内容,如果未能解决你的问题,请参考以下文章

Yii2 hasMany关系中如何在ON条件下使用常量

Laravel eloquent apply whereHas on the latest record of hasMany 关系

PHP 显示首页而不是Paginate

PHP Paginate段落 - 每页显示一定数量的段落

php 在查询中组合Order by和Paginate

PHP Redeclare Paginate var in function | CakePHP的