我一个在用户模型许多关于申报代码..如何计算用户在laravel elloquent模型中发表的所有评论?
public function post()
{
$this->hasMany('App\Post', 'userid','id');// id--from user
}
我的一个在Post模型许多关于申报代码..
public function comment()
{
$this->hasMany('App\Comment', 'postid','pid');// id--from post
}
现在我想检索用户的所有评论但是如何?
谢谢!问题解决了 :) –