/** * Creates a new Board model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Board(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new Board model. * If creation is successful, the browser will be redirected to the 'view' page. * * @return mixed */ public function actionCreate() { $model = new Board(); $model->loadDefaultValues(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Board::createCache(); return $this->redirect(['index']); } else { $locals = []; $locals['boardArrayTree'] = Board::getBoardArrayTree(); $locals['model'] = $model; return $this->render('create', $locals); } }