Ejemplo n.º 1
0
 public function actionCreate()
 {
     $model = new Distributor();
     if ($model->load(Yii::$app->request->post())) {
         $kd = Yii::$app->esmcode->kdDbtr();
         $model->KD_DISTRIBUTOR = $kd;
         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']);
     } else {
         return $this->renderAjax('create', ['model' => $model]);
     }
 }