laravel关联模型如何处理文章,评论,评论用户

老师,我现在有一个article表,一个user表,一个comment

image

我想通过文章查询出所有评论以及评论对应的from_uid,与to_uid
目前在文章模型下建立1对多关系,可以拿到文章下的所有评论和评论用户id,

 //一对一关联,关联文章发布用户id
    public function user()
    {
        return $this->hasOne('App\Http\Models\User', 'id', 'u_id');
    }

    //一对多关联,关联文章下所有的评论
    public function comments()
    {
        return $this->hasMany('App\Http\Models\Comment', 'a_id', 'id');
    }

得到如下数据

{
id: 13,
u_id: 1,
content: "黎明的曙光??",
imgs: "["storage/images/20170803/5982abaca07fa.jpeg", "storage/images/20170803/5982abaca0a64.jpeg", "storage/images/20170803/5982abaca0cd5.jpeg", "storage/images/20170803/5982abaca0e5d.jpeg", "storage/images/20170803/5982abaca0fdd.jpeg", "storage/images/20170803/5982abaca117a.jpeg"]",
thumb_imgs: "["storage/images/20170803/5982abaca07fa.jpeg", "storage/images/20170803/5982abaca0a64.jpeg", "storage/images/20170803/5982abaca0cd5.jpeg", "storage/images/20170803/5982abaca0e5d.jpeg", "storage/images/20170803/5982abaca0fdd.jpeg", "storage/images/20170803/5982abaca117a.jpeg"]",
created_at: "2017-08-03 12:50:52",
updated_at: "2017-08-03 12:50:52",
user: {
id: 1,
openid: "oi6D5wVHOi_b--y1EhJCpihZf3mQ",
nickname: "Zc",
sex: 1,
country: "中国",
province: "广东",
city: "深圳",
headimgurl: "http://wx.qlogo.cn/mmopen/RjeiaaLibAWLGEnHXcrl0IlXlnKfAlzZBfO9wvnwOyMvJcZUg8ZYPTV9dRNxNZbekLBRTJFfX7G3VzoAAic1f0viciakzSy39dicvx/0",
created_at: "2017-07-20 15:46:06",
updated_at: "2017-08-02 00:14:41"
},
comments: [
{
id: 1,
from_uid: 1,
to_uid: 0,
a_id: 13,
content: "来一条评论",
created_at: "2017-08-04 12:04:04",
updated_at: "2017-08-04 12:04:07"
},
{
id: 2,
from_uid: 2,
to_uid: 1,
a_id: 13,
content: "回复第一条评论",
created_at: "2017-08-04 12:09:56",
updated_at: "2017-08-04 12:09:58"
}
]
}

现在的问题就是如何把评论用户id 拿到user表中对应的用户名。

假如_丶
修改的评论也不能少于六个字哦!
zhouchang2017 回复 假如_丶
修改的评论也不能少于六个字哦!
tufeiax123
修改的评论也不能少于六个字哦!
zhouchang2017 回复 tufeiax123
修改的评论也不能少于六个字哦!
tufeiax123
修改的评论也不能少于六个字哦!