where('game_channel_id', $channelId)->count(); Db::name('game_channel')->where('id', $channelId)->update(['user_count' => $count]); } /** * @param list $channelIds */ public static function syncChannels(array $channelIds): void { $seen = []; foreach ($channelIds as $cid) { if ($cid === null || $cid === '') { continue; } $k = (string) $cid; if (isset($seen[$k])) { continue; } $seen[$k] = true; self::syncFromGameUser($cid); } } }