public function actionCreateAliasCustomers($id) { $model = new Customersalias(); $id = Customers::find()->where(['CUST_KD' => $id])->one(); $nama = $id->CUST_NM; if ($model->load(Yii::$app->request->post())) { $model->CREATED_AT = date('Y-m-d'); $model->CREATED_BY = Yii::$app->user->identity->username; $model->KD_PARENT = 1; if ($model->save()) { echo 1; } else { echo 0; } } else { return $this->renderAjax('alias_customers', ['model' => $model, 'id' => $id, 'nama' => $nama]); } }
public function actionTambahAliasCustomers() { $model = new Customersalias(); if ($model->load(Yii::$app->request->post())) { if ($model->validate()) { $model->CREATED_BY = Yii::$app->user->identity->username; $model->CREATED_AT = date("Y-m-d H:i:s"); $model->save(); return $this->redirect(['index-alias']); } } else { return $this->renderAjax('formalias', ['model' => $model, 'cus_data' => self::aryData_Customers(), 'cus_dis' => self::aryData_Dis()]); } }