我正在尝试实现一个sql查询
select * from user,comments where comments.user_id= user.id
Run Code Online (Sandbox Code Playgroud)
所以我getcomments使用以下代码在我的用户模型上创建一个方法
public function comments(){return $this->hasMany('Comments')}
Run Code Online (Sandbox Code Playgroud)
现在正在通过以下方式访问数据
$data = User::find(1)->comments;
Run Code Online (Sandbox Code Playgroud)
但它只给了我来自评论表的数据(不是用户和评论)我该怎么做