/var/www/vhosts/nabawater/backend/controllers
Edit: /var/www/vhosts/nabawater/backend/controllers/VendorBankController.php (2880B)
render('index',
[
'searchModel' => $searchModel,
'dataProvider' => $searchModel->search(Yii::$app->request->queryParams)
]
);
}
/**
*
* @return string
*
* @Title("Create")
*/
public function actionCreate()
{
$model = new VendorBank();
$modelVendor = new Vendor();
$post = Yii::$app->getRequest()->post();
if ($model->load($post) && $model->validate()) {
$model->save();
Com::successFlash('Created Successfully');
return $this->redirect(['index']);
}
return $this->render('create', [
'model' => $model,
'modelVendor' => $modelVendor
]);
}
/**
*
* @param type $id
* @return string
*
* @Title("Update")
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
$modelVendor = new Vendor();
$post = Yii::$app->getRequest()->post();
if ($model->load($post)) {
$model->save();
Com::successFlash('Updated Successfully');
return $this->redirect(['index']);
}
return $this->render('update', [
'model' => $model,
'modelVendor' => $modelVendor
]);
}
/**
* @return string
* @param type $id
*
* @Title("Delete")
*/
public function actionDelete($id)
{
$model = $this->findModel($id);
if ($model === null) {
Com::failureFlash('Unable to find the Vendor Bank Detail');
return $this->redirect(['index']);
}
VendorBank::deleteAll(['vendor_bank_key' => $id]);
$model->save();
Com::successFlash('Deleted Successfully');
return $this->redirect(['index']);
}
/**
*
* @param type $id
* @return $model
* @throws NotFoundHttpException
*/
protected function findModel($id)
{
if (($model = VendorBank::findOne(['vendor_bank_key' => $id])) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}