public function actionPost($id) { $post = $this->loadModel($id); $model = new \app\models\ForumMessage(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { $model->save(false); $model = new \app\models\ForumMessage(); } $messages = \app\models\ForumMessage::find()->where(['status' => 1, 'post_id' => $id, 'answer' => 0])->orderBy('id asc')->all(); $category = \app\models\ForumCategory::findOne($post->category); return $this->render('post', array('post' => $post, 'messages' => $messages, 'category' => $category, 'model' => $model)); }