/**
  * Creates a new Posts model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     if (\yii::$app->user->can('BlogCreatePost')) {
         $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]);
         }
     } else {
         throw new \yii\web\NotAcceptableHttpException('No Permission to create new post');
     }
 }