Ejemplo n.º 1
0
 public function actionUpdateUserType()
 {
     if ($this->isUpdateAllowed()) {
         if (Yii::$app->request->post()) {
             $userTypeModel = UserType::findOne(Yii::$app->request->get()['id']);
             $userTypeModel->name = Yii::$app->request->post()['name'];
             $userTypeModel->role = Yii::$app->request->post()['role'];
             $userTypeModel->update();
             /*return $this->render('user_type_list');*/
             return $this->redirect(['security/user-type-management']);
         }
         return $this->render('update_user_type');
     } else {
         echo "You don't have access here";
         die;
     }
 }
Ejemplo n.º 2
0
 /**
  * Finds the UserType model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return UserType the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = UserType::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }