/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Recvsmstable::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 15]]); $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->orderBy("SmsTime DESC"); $query->andFilterWhere(['SmsIndex' => $this->SmsIndex, 'SmsTime' => $this->SmsTime, 'NewFlag' => $this->NewFlag, 'SendTime' => $this->SendTime]); $query->andFilterWhere(['like', 'SendNumber', $this->SendNumber])->andFilterWhere(['like', 'SmsContent', $this->SmsContent])->andFilterWhere(['like', 'RecvModemSet', $this->RecvModemSet])->andFilterWhere(['like', 'SMSCID', $this->SMSCID]); return $dataProvider; }
/** * Finds the Recvsmstable model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Recvsmstable the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Recvsmstable::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }