/** * Validate receiver * * @param $attribute * @param $params */ public function valdateReceiver($attribute, $params) { if ($this->messageType == self::MESSAGE_TO_USER) { $this->receiverId = Chat::decodeUserId($this->receiverId); } elseif ($this->messageType == self::MESSAGE_TO_DIALOG) { $this->receiverId = Chat::decodeDialogId($this->receiverId); } else { $this->addError($attribute, 'Incorrect receiver'); } }
/** * Delete dialog (change status) * * @param $dialogId * @return array */ public function actionDeleteDialog($dialogId) { return ['status' => PoprigunChatDialog::deleteDialog(Chat::decodeDialogId($dialogId)) ? 'success' : 'error']; }