示例#1
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]);
 }