/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = PaymentChannel::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->joinWith('customer'); $query->andFilterWhere(['payment_channel_id' => $this->payment_channel_id, 'payment_category' => $this->payment_category, 'cc_type' => $this->cc_type, 'exp_month' => $this->exp_month, 'exp_year' => $this->exp_year, 'flag_active' => $this->flag_active, 'date_added' => $this->date_added, 'date_update' => $this->date_update]); $query->andFilterWhere(['like', 'payment_channel_name', $this->payment_channel_name])->andFilterWhere(['like', 'first_name', $this->customer_id])->andFilterWhere(['like', 'cc_no', $this->cc_no])->andFilterWhere(['like', 'cvv', $this->cvv])->andFilterWhere(['like', 'paypal_id', $this->paypal_id]); return $dataProvider; }
/** * Finds the PaymentChannel model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $payment_channel_id * @param integer $customer_id * @return PaymentChannel the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($payment_channel_id, $customer_id) { if (($model = PaymentChannel::findOne(['payment_channel_id' => $payment_channel_id, 'customer_id' => $customer_id])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }