コード例 #1
0
ファイル: UserTypeController.php プロジェクト: raguila/islc
 /**
  * Creates a new UserType model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new UserType();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->UserTypeID]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #2
0
 /**
  * Create new usertype
  *
  * @return Response
  */
 public function saveUserType(Request $request)
 {
     //Validate the Request
     $this->validate($request, ['name' => 'required|unique:user_types|max:255']);
     $ut = new UserType();
     $ut->name = $request->name;
     $ut->save();
     \Session::flash('flash_message', $request->name . ' has been created!');
     \Session::flash('flash_message_level', 'success');
     return Redirect::to('admin/usertype');
 }
コード例 #3
0
 public function actionCreateUserType()
 {
     if ($this->isInsertAllowed()) {
         if (Yii::$app->request->post()) {
             $userTypeModel = new UserType();
             $userTypeModel->name = Yii::$app->request->post()['name'];
             $userTypeModel->role = Yii::$app->request->post()['role'];
             $userTypeModel->save();
             /*return $this->render('user_type_list');*/
             return $this->redirect(['security/user-type-management']);
         }
         return $this->render('create_user_type');
     } else {
         echo "You don't have access here";
         die;
     }
 }