示例#1
0
 public function actionCreatez()
 {
     $model = new Drivers();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $this->CreateDirDriver($model->ref);
         $model->docs = $this->uploadMultipleFileDriver($model);
         if ($model->save()) {
             Yii::$app->getSession()->setFlash('alert1', ['type' => 'success', 'duration' => 10000, 'icon' => 'fa fa-bus', 'message' => 'บันทึกข้อมูลเสร็จเรียบร้อย ผู้ขับรถ -  ' . $model->fullname, 'title' => 'การบันทึกข้อมูล', 'positonY' => 'top', 'positonX' => 'right']);
             return $this->redirect(['view', 'id' => $model->appilcant_id]);
             echo 1;
         } else {
             echo 0;
         }
     } else {
         $model->ref = substr(Yii::$app->getSecurity()->generateRandomString(), 10);
         return $this->renderAjax('createz', ['model' => $model]);
     }
 }