在我的岗位型号属性[***]不能在此集合实例Laravel雄辩关系存在
public function user()
{
return $this->belongsTo('App\User');
}
和用户模式
public function posts()
{
return $this->hasMany('App\Post');
}
现在我想获得的评论特定用户的
$user= User::where('name', 'like', '%Mat%')->first();
return $user->posts->comment;
但它显示
属性[注释]在此收集实例中不存在。