hasOne(CommunityCategory::class, 'id', 'cid'); } /** * @notes 扣减文章数量 * @param $id * @return mixed * @author 段誉 * @date 2022/5/10 16:43 */ public static function decArticleNum($id) { return self::where([ ['id', '=', $id], ['article_num', '>=', 1] ])->dec('article_num')->update(); } }