public function actionUpdate($id)
    {
        $model = $this->findModel($id);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->setFlash('postSaved');
        }

        if ($model->type->show_category) {
            $model->setScenario('required_category');
        }

        return $this->render('update', ['model' => $model]);
    }
public function actionUpdate($id)
    {
        $model = $this->findModel($id);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->setFlash('postSaved');
        }

        if ($model->type->show_category) {
            $model->setScenario('required_category');
        }

        return $this->render('update', ['model' => $model]);
    }
public function actionUpdate ( $ id ) { $ model = $ this -> findModel ( $ id ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { Yii :: $ app -> session -> setFlash ( 'postSaved' ) ; } if ( $ model -> type -> show_category ) { $ model -> setScenario ( 'required_category' ) ; } return $ this -> render ( 'update' , [ 'model' => $ model ] ) ; }
Updates an existing Post model.
If update is successful, the browser will be redirected to the 'view' page.
@param integer $id
@return mixed
Updates an existing Post model . If update is successful the browser will be redirected to the view page .