コード例 #1
0
 /**
  * Creates a new Departments model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Departments();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #2
0
ファイル: Departments.php プロジェクト: bderevyaga/VINDIM
 public static function addDepartments($input)
 {
     foreach ($input as $value) {
         if ($value != null) {
             $departments = new Departments();
             $departments->name = $value;
             $departments->condition = 1;
             $departments->save();
         }
     }
 }
コード例 #3
0
 /**
  * Creates a new Departments model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Departments();
     if ($model->load(Yii::$app->request->post())) {
         $model->department_created_date = date('Y-m-d');
         $model->save();
         return $this->redirect(['view', 'id' => $model->department_id]);
     } else {
         return $this->renderAjax('create', ['model' => $model]);
     }
 }