Пример #1
0
 /**
  * @inheritdoc
  */
 public function markAsRead(Message &$dialog)
 {
     $result = Message::updateAll(['read' => Message::STATUS_READ], ArrayHelper::merge($dialog->getAttributes(['from', 'to']), ['read' => Message::STATUS_UNREAD]));
     if ($result) {
         $dialog->read = Message::STATUS_READ;
     }
 }
Пример #2
0
 public function actionShowInbox()
 {
     Message::updateAll(['is_notified' => 1], 'is_notified=0 AND receiver_id=' . \Yii::$app->user->getId());
     $query = Message::find()->where(['receiver_id' => \Yii::$app->user->getId()])->orderBy('status');
     $pagination = new Pagination(['defaultPageSize' => 15, 'totalCount' => $query->count()]);
     $listMsg = $query->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('inbox', ['model' => $listMsg, 'pagination' => $pagination]);
 }
Пример #3
0
 public function actionMakeOldMessageNotification()
 {
     Message::updateAll(['is_notified' => 1], 'is_notified=0 AND receiver_id=' . \Yii::$app->user->getId());
 }