/** * Creates a new PostCategory model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new PostCategory(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'post_id' => $model->post_id, 'category_id' => $model->category_id]); } else { return $this->render('create', ['model' => $model]); } }
public function actionCreate() { $model = new PostCategory(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['list']); } else { $model->status = PostCategory::STATUS_ENABLED; return $this->render('create', ['model' => $model]); } }