public function actionCreate()
 {
     $user = new Users();
     if ($user->load(Yii::$app->request->post()) && $user->validate()) {
         $user['user_active_from'] = date("Y-m-d");
         $user->save();
         return $this->redirect('index');
     }
     return $this->render('create', ['user' => $user]);
 }
 public function actionUpdate($id)
 {
     $id = (int) $id;
     if (empty($id)) {
         return $this->redirect('index');
     }
     $user = new Users();
     $sql = $user->sqlActivDelete($id);
     //проверяем активна запись для изменения
     $query = Users::findBySql($sql)->count();
     if ($query == 0) {
         return $this->redirect('index');
     }
     $sql = $user->findOne($id);
     if ($user->load(Yii::$app->request->post()) && $user->validate()) {
         $sql->updateAll(['user_name' => $_POST['Users']['user_name']], ['user_id' => $id]);
         return $this->redirect('index');
     }
     return $this->render('update', ['user' => $sql]);
 }