Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UserPayment::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, 'user_id' => $this->user_id, 'exp_year' => $this->exp_year, 'time' => $this->time]);
     $query->andFilterWhere(['like', 'payment_type', $this->payment_type])->andFilterWhere(['like', 'details', $this->details])->andFilterWhere(['like', 'card_no', $this->card_no])->andFilterWhere(['like', 'exp_mnth', $this->exp_mnth])->andFilterWhere(['like', 'scc', $this->scc])->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'last_name', $this->last_name])->andFilterWhere(['like', 'street', $this->street])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'zip', $this->zip])->andFilterWhere(['like', 'country', $this->country])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUserPayments()
 {
     return $this->hasMany(UserPayment::className(), ['user_id' => 'id']);
 }
 /**
  * Finds the UserPayment model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return UserPayment the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = UserPayment::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }