/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = UserNotifications::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(['user_id' => $this->user_id, 'new_req' => $this->new_req, 'upd_req' => $this->upd_req, 'del_req' => $this->del_req, 'exp_req' => $this->exp_req, 'succ_req' => $this->succ_req, 'new_bid' => $this->new_bid, 'upd_bid' => $this->upd_bid, 'del_bid' => $this->del_bid, 'rej_bid' => $this->rej_bid, 'rep_bid' => $this->rep_bid, 'awa_bid' => $this->awa_bid, 'exp_bid' => $this->exp_bid, 'new_rev' => $this->new_rev, 'new_rate' => $this->new_rate, 'new_comm' => $this->new_comm, 'new_rcmnd' => $this->new_rcmnd, 'new_deal' => $this->new_deal, 'subs_deal' => $this->subs_deal, 'upd_deal' => $this->upd_deal, 'exp_deal' => $this->exp_deal, 'del_deal' => $this->del_deal, 'upd_memb' => $this->upd_memb, 'exp_memb' => $this->exp_memb, 'jubilee' => $this->jubilee, 'update_time' => $this->update_time]); return $dataProvider; }
/** * Updates an existing UserNotifications model. * If update is successful, the browser will be redirected to the 'view' page. * @param string $id * @return mixed */ public function actionUpdate($username = null) { if (isset($username)) { $user = User::find()->where(['username' => $username])->one(); } if ($user) { $model = UserNotifications::find()->where('user_id=:user_id', [':user_id' => $user->id])->one(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->user_id]); } else { return $this->render('update', ['model' => $model]); } } else { $this->redirect(Yii::$app->request->baseUrl . '/providers'); } }