field('uid,nickname,avatar'); } public function article(): HasOne { return self::hasOne(Article::class, 'id', 'aid')->field('*'); } // 统计文章评论数 public function counts($id) { $model = new self(); $counts=$model::where('aid',$id)->count(); return $counts; } }