コード例 #1
0
ファイル: DefaultController.php プロジェクト: Dominus77/blog
 /**
  * Просмотр поста.
  * @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()]);
 }
コード例 #2
0
ファイル: PostComment.php プロジェクト: Dominus77/blog
 /**
  * @param $id
  * @return Post
  * @throws \yii\web\NotFoundHttpException
  */
 public function getModelMaterial($id)
 {
     $model = new Post();
     $post = $model->getPost($id);
     return $post;
 }