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