コード例 #1
0
 /**
 * Creates data provider instance with search query applied
 *
 * @param array $params
 *
 * @return ActiveDataProvider
 */
 public function search($params)
 {
     $query = Payment::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'student_id' => $this->student_id, 'amount' => $this->amount, 'date' => $this->date, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * Finds the Payment model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Payment the loaded model
  * @throws HttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Payment::findOne($id)) !== null) {
         return $model;
     } else {
         throw new HttpException(404, 'The requested page does not exist.');
     }
 }
コード例 #3
0
 public function actionUpdatePayment($paymentId)
 {
     $payment = Payment::findOne($paymentId);
     if (!isset($payment)) {
         throw new HttpException(404, 'The requested page does not exist.');
     }
     if ($payment->load(Yii::$app->request->post()) && $payment->save()) {
         Yii::$app->session->setFlash('info', "Payment updated successfully");
         return $this->redirect(['default/list-payments']);
     }
     return $this->render('update-payment', compact('payment'));
 }
コード例 #4
0
ファイル: User.php プロジェクト: RubenDjOn/PrivateTeacher
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPayments()
 {
     return $this->hasMany(\common\models\Payment::className(), ['created_by' => 'id']);
 }
コード例 #5
0
 public function actionUninstall()
 {
     $code = \yii::$app->request->get('code');
     if (empty($code)) {
         UtilD::toJavaScriptAlert(\yii::t('app', 'invalid_parameter'), 'back');
         \yii::$app->end();
     }
     $sta = Payment::uninstall($code);
     if ($sta) {
         AdminLog::admin_log($code, 'uninstall', 'payment');
     }
     $this->redirect('/payment/list');
 }