public function actionRecharge() { $model = Yii::createObject(Recharge::className()); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['withdrawal-log']); } else { return $this->render('createRecharge', ['model' => $model]); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Recharge::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(['recharge_id' => $this->recharge_id, 'user_id' => $this->user_id, 'money' => $this->money, 'status' => $this->status, 'create_at' => $this->create_at, 'update_at' => $this->update_at]); return $dataProvider; }