/** * Просмотр поста. * @param string $id идентификатор поста * @return string */ public function actionView($id) { $model = new Post(); // Получаем пост $post = $model->getPost($id); return $this->render('view', ['post' => $post, 'modelComments' => new PostComment()]); }
/** * @param $id * @return Post * @throws \yii\web\NotFoundHttpException */ public function getModelMaterial($id) { $model = new Post(); $post = $model->getPost($id); return $post; }