group('type')->field('type,count(id) as count')->select(); } /** * 获取当前用户未读通知数量 * @return int */ public static function getUnreadCount() { $userId = session('user.id'); if (!$userId) { return 0; } return static::mk() ->where('staff_id', $userId) ->whereNull('read_at') ->count(); } }