Ejemplo n.º 1
0
 /**
  * Creates a new Invite model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Invite();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => (string) $model->_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Ejemplo n.º 2
0
 public function invite()
 {
     $post = Yii::$app->request->post();
     $user = new Invite();
     $user->user_id = new \MongoId($post["recipient-id"]);
     $user->patient_id = new \MongoId(Yii::$app->user->identity->_id);
     $user->description = $post['message-text'];
     $user->created_at = date("Y-m-d H:i:s");
     $user->status = 1;
     $user->msg_status = 1;
     if ($user->save()) {
         return $user;
     }
 }