Пример #1
0
 /**
  *
  * @param type $recipient
  * @return \Zbase\Entity\Laravel\Message\Recipient
  */
 protected function _msgRecipient($recipient)
 {
     $msgRecipient = new Recipient();
     if (!$recipient instanceof \Zbase\Entity\Laravel\User\User && is_numeric($recipient)) {
         $recipient = zbase_user_byid($recipient);
     }
     if ($recipient instanceof \Zbase\Entity\Laravel\User\User) {
         $msgRecipient->user_id = $recipient->id();
     }
     $msgRecipient->read_status = 0;
     $msgRecipient->admin_read_status = 1;
     $msgRecipient->trash_status = 0;
     $msgRecipient->reply_status = 0;
     $msgRecipient->status = 2;
     $msgRecipient->is_in = 1;
     $msgRecipient->is_out = 0;
     $msgRecipient->message_id = $this->message_id;
     $msgRecipient->save();
     return $msgRecipient;
 }
Пример #2
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     //var_dump($model->recipients);
     if (isset($_POST['Event'])) {
         $model->attributes = $_POST['Event'];
         if ($model->save()) {
             $recipient = new Recipient();
             $recipient->email = "emailaddress1";
             $recipient->event_id = $model->id;
             if (!$recipient->save()) {
                 var_dump($recipient->getErrors());
                 die;
             }
             $this->redirect(array('update', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model));
 }