/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = MobileUsers::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->andFilterWhere(['id' => $this->id, 'date_created' => $this->date_created, 'locked' => $this->locked, 'incorrect_access_count' => $this->incorrect_access_count, 'pin_change_flag' => $this->pin_change_flag, 'parent_insurance_company' => $this->parent_insurance_company]); $query->orFilterWhere(['ilike', 'phone_number', $this->modelSearch])->orFilterWhere(['ilike', 'name', $this->modelSearch])->orFilterWhere(['ilike', 'type', $this->modelSearch]); unset($_SESSION['exportData']); $_SESSION['exportData'] = $dataProvider; return $dataProvider; }
/** * Finds the MobileUsers model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return MobileUsers the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = MobileUsers::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }