Exemple #1
0
 public function actionSendToManager($idChat, $message)
 {
     Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     $model = new Messages();
     $model->id_chat = $idChat;
     $model->from_user = Yii::$app->user->getId();
     $model->to_user = \app\modules\user\models\UserClient::findOne(['user_id' => $model->from_user])->manager_id;
     $model->message = $message;
     if ($model->save()) {
         return ['status' => true];
     } else {
         return ['status' => false];
     }
 }
Exemple #2
0
 public function getClient()
 {
     return $this->hasOne(UserClient::className(), ['user_id' => 'user_id']);
 }