/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = UraStampdutyPrnReg::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, 'date_registered' => $this->date_registered, 'payment_id' => $this->payment_id, 'date_pushed_to_bank' => $this->date_pushed_to_bank, 'date_confirmed' => $this->date_confirmed]); $query->orFilterWhere(['ilike', 'vrn', $this->modelSearch])->orFilterWhere(['ilike', 'tin', $this->modelSearch])->orFilterWhere(['ilike', 'registered_name', $this->modelSearch])->orFilterWhere(['ilike', 'amount', $this->modelSearch])->orFilterWhere(['ilike', 'prn', $this->modelSearch])->orFilterWhere(['ilike', 'status', $this->modelSearch])->orFilterWhere(['ilike', 'bank_trans_ref', $this->modelSearch])->orFilterWhere(['ilike', 'ura_trans_ref', $this->modelSearch]); unset($_SESSION['exportData']); $_SESSION['exportData'] = $dataProvider; return $dataProvider; }
/** * Finds the UraStampdutyPrnReg model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return UraStampdutyPrnReg the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = UraStampdutyPrnReg::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }