示例#1
0
 /**
  * Creates a new Group model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Group();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
示例#2
0
 public function actionCreate()
 {
     $group = new Group();
     Yii::$app->response->format = 'json';
     if ($group->load(Yii::$app->request->post()) && $group->save()) {
         return ['errors' => '', 'data' => $this->renderPartial('@widget/views/groups/_add', ['group' => $group])];
     }
     return ['errors' => '', 'data' => $this->renderPartial('@widget/views/groups/_add', ['group' => $group])];
 }
示例#3
0
 /**
  * Creates a new Group model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $app = \Yii::$app;
     $model = new Group();
     $render = "render";
     if ($app->request->isPjax || $app->request->isAjax) {
         $render = "renderPartial";
     }
     if ($model->load($app->request->post()) && $model->save()) {
         $model = new Group();
     }
     return $this->{$render}('form', ['model' => $model]);
 }