/** * Creates a new Posts model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Posts(); $model->user_created = \Yii::$app->user->getId(); $model->user_last_change = \Yii::$app->user->getId(); if ($model->load(Yii::$app->request->post()) && $model->save()) { // $model->user_created = \Yii::$app->user->getId(); // $model->user_last_change = \Yii::$app->user->getId(); $model->update(); return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }