public function updateModeratorForOne($forumId = null)
    {
        try {
            if ((new Query())->from(Mod::tableName())->where([
                    'forum_id' => $forumId,
                    'user_id' => $this->id
                ])->exists()) {
                Podium::getInstance()->db->createCommand()->delete(Mod::tableName(), [
                    'forum_id' => $forumId,
                    'user_id' => $this->id
                ])->execute();
            } else {
                Podium::getInstance()->db->createCommand()->insert(Mod::tableName(), [
                    'forum_id' => $forumId,
                    'user_id' => $this->id
                ])->execute();
            }
            Podium::getInstance()->podiumCache->deleteElement('forum.moderators', $forumId);
            Log::info('Moderator updated', $this->id, __METHOD__);
            return true;
        } catch (Exception $e) {
            Log::error($e->getMessage(), null, __METHOD__);
        }
        return false;
    }
public function updateModeratorForOne($forumId = null)
    {
        try {
            if ((new Query())->from(Mod::tableName())->where([
                    'forum_id' => $forumId,
                    'user_id' => $this->id
                ])->exists()) {
                Podium::getInstance()->db->createCommand()->delete(Mod::tableName(), [
                    'forum_id' => $forumId,
                    'user_id' => $this->id
                ])->execute();
            } else {
                Podium::getInstance()->db->createCommand()->insert(Mod::tableName(), [
                    'forum_id' => $forumId,
                    'user_id' => $this->id
                ])->execute();
            }
            Podium::getInstance()->podiumCache->deleteElement('forum.moderators', $forumId);
            Log::info('Moderator updated', $this->id, __METHOD__);
            return true;
        } catch (Exception $e) {
            Log::error($e->getMessage(), null, __METHOD__);
        }
        return false;
    }
public function updateModeratorForOne ( $ forumId = null ) { try { if ( ( new Query ( ) ) -> from ( Mod :: tableName ( ) ) -> where ( [ 'forum_id' => $ forumId , 'user_id' => $ this -> id ] ) -> exists ( ) ) { Podium :: getInstance ( ) -> db -> createCommand ( ) -> delete ( Mod :: tableName ( ) , [ 'forum_id' => $ forumId , 'user_id' => $ this -> id ] ) -> execute ( ) ; } else { Podium :: getInstance ( ) -> db -> createCommand ( ) -> insert ( Mod :: tableName ( ) , [ 'forum_id' => $ forumId , 'user_id' => $ this -> id ] ) -> execute ( ) ; } Podium :: getInstance ( ) -> podiumCache -> deleteElement ( 'forum.moderators' , $ forumId ) ; Log :: info ( 'Moderator updated' , $ this -> id , __METHOD__ ) ; return true ; } catch ( Exception $ e ) { Log :: error ( $ e -> getMessage ( ) , null , __METHOD__ ) ; } return false ; }
Updates moderator assignment for given forum.
@param int $forumId forum ID
@return bool
@since 0.2
Updates moderator assignment for given forum .