update cms

This commit is contained in:
JaguarJack
2021-05-31 08:43:40 +08:00
parent 44f5bf345b
commit 72bf97579b
2 changed files with 59 additions and 1 deletions

View File

@@ -75,7 +75,7 @@ class Articles extends BaseModel
// 喜欢
'likes',
// 评论数
'comments',
'comment_num',
// 1 置顶 2 非置顶
'is_top',
// 1 推荐 2 不推荐
@@ -182,4 +182,15 @@ class Articles extends BaseModel
{
return $this->tag()->attach($ids);
}
/**
* 文章评论
*
* @time 2021年05月27日
* @return \think\model\relation\HasMany
*/
public function comments(): \think\model\relation\HasMany
{
return $this->hasMany(Comments::class, 'article_id', 'id');
}
}