Esempio n. 1
0
 private function getMessages()
 {
     $model = new Messages();
     $messages = $model->find()->limit(10)->orderBy('id DESC')->asArray()->all();
     $messages = json_encode($messages);
     return $messages;
 }
Esempio n. 2
0
 public function getRead($id)
 {
     $inbox = Messages::find($id);
     $inbox->status = 1;
     $inbox->save();
     return View::make('admin.inbox.readmessage', ['pageInfo' => ['siteTitle' => 'Inbox', 'pageHeading' => 'Inbox', 'pageHeadingSlogan' => 'Here is the place to contact with me'], 'data' => $inbox]);
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Messages::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'tanggal' => $this->tanggal]);
     $query->andFilterWhere(['like', 'dari', $this->dari])->andFilterWhere(['like', 'ke', $this->ke])->andFilterWhere(['like', 'isi', $this->isi]);
     return $dataProvider;
 }
 public function searchOwnMessages($params)
 {
     $query = Messages::find()->joinWith(['sender' => function ($query) {
         $query->from(['senderName' => 'user']);
     }]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->sort->attributes['created_at'] = ['asc' => ['created_at' => SORT_ASC], 'desc' => ['created_at' => SORT_DESC]];
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     $query->joinWith('senderName');
     $query->andFilterWhere(['content' => $this->content])->andFilterWhere(['like', 'senderName.username', $this->sender])->andFilterWhere(['like', 'created_at', $this->created_at])->andFilterWhere(['recepient' => Yii::$app->user->identity->id])->orderBy(['created_at' => SORT_DESC]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Messages::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'type' => $this->type, 'status' => $this->status, 'create_time' => $this->create_time, 'update_time' => $this->update_time]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'create_user', $this->create_user])->andFilterWhere(['like', 'update_user', $this->update_user]);
     $query->orderBy('id desc');
     return $dataProvider;
 }
Esempio n. 6
0
 public function getReadMails()
 {
     $user = Session::read('member');
     $id = $user['_id'];
     $getReadMails = Messages::find('all', array('conditions' => array('refer_id' => $id, 'read' => 1)));
     return $getReadMails;
 }
 /**
  * Lists all Messages models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Messages::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
Esempio n. 8
0
 public function actionAnton()
 {
     $foo = Messages::find()->all();
     return $this->render('anton', ['foobar' => 'qwerty', 'foo' => $foo]);
 }