示例#1
0
 /**
  * Creates a new Groups model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Groups();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('group-form', ['model' => $model]);
     }
 }
 /**
  * Creates a new Groups model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Groups();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['index']);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
示例#3
0
 /**
  * render Creategroup.php with $model = new Groups();
  * 
  * @return $this->render('signup', ['model' => $model])
  */
 public function actionCreategroup()
 {
     $user = $this->getUser();
     $group = new Groups();
     $group->l_user = $user->username;
     $group->create_date = date("Y-m-d");
     $group->status = 'o';
     if ($group->load(Yii::$app->request->post()) && $group->validate()) {
         if (!$group->groupExist()) {
             if ($group->save()) {
                 return $this->goHome();
             } else {
                 return $this->render('say', ['message' => 'GroupErr']);
             }
         } else {
             return $this->render('error', ['name' => 'error', 'message' => "You Created this group {$group->groupname}..."]);
         }
     }
     return $this->render('creategroup', ['model' => $group]);
 }