我一個在用戶模型許多關於申報代碼..如何計算用戶在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
}
現在我想檢索用戶的所有評論但是如何?
謝謝!問題解決了 :) –