public function actionCreate() { $model = new Bank(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } else { return $this->render('create', ['type' => "create", 'model' => $model]); } }
public function search($params) { $query = Bank::find(); if (!isset($params['sort'])) { $query->orderBy(['id_bank' => SORT_DESC]); } $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->andFilterWhere(['bank_id' => $this->bank_id, 'name' => $this->name]); return $dataProvider; }
public function getBank() { return $this->hasOne(Bank::className(), ['id_bank' => 'id_bank']); }
<?php use yii\helpers\Html; use common\models\Bank; use common\models\Pool; $this->title = 'Update Bank Pool: ' . ' ' . Bank::find()->where(["id_bank" => $model->id_bank])->one()->name . " for " . Pool::find()->where(["id_pool" => $model->id_pool])->one()->pool_id; $this->params['breadcrumbs'][] = ['label' => 'Bank Pool', 'url' => ['index']]; $this->params['breadcrumbs'][] = 'Update'; ?> <div class="BankPool-update"> <h1><?php echo Html::encode($this->title); ?> </h1> <div style="overflow:hidden" class="panel"> <?php echo $this->render('_form', ['model' => $model, 'type' => $type, 'bank' => $bank]); ?> </div> <div style="height:20px"></div> </div>
public function actionGetval() { $id_bank = $_REQUEST['id_bank']; $bankname = Bank::find()->where(['id_bank' => $id_bank])->one(); $arr['name'] = $bankname['name']; exit(json_encode($arr)); }
/** * 银行卡列表 */ public function actionBankList() { if ($data = Bank::getInstance()->bankList()) { $this->renderAjax(['status' => 1, 'data' => $data, 'msg' => '删除数据成功']); } else { $this->renderAjax(['status' => 0, 'data' => [], 'msg' => '删除数据失败']); } }