public static function isUserInChat($chatId, $userId) { $db = Mdb::GetConnection(); $collection = $db->selectCollection(Mdb::$dbname, 'chat'); $result = $collection->findOne(['_id' => intval($chatId), 'members' => ['$all' => [intval($userId)]]], ['_id' => true]); return empty($result) ? false : true; }
public static function setLanguage($lng) { $db = Mdb::GetConnection(); $collection = $db->selectCollection(Mdb::$dbname, 'user'); $result = $collection->update(['_id' => self::getUserId()], ['$set' => ['lng' => $lng]]); }