Пример #1
0
 /**
  * @param $id
  * @return string
  * @throws NotFoundHttpException
  */
 public function actionView($id)
 {
     $comment = new Comment();
     $num = $comment->countByUser($id);
     $commentData = $comment->getCommentByNewsId($id);
     $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $commentData->count()]);
     $commentData = $commentData->orderBy('created_at DESC')->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('view', ['model' => $this->findModel($id), 'comment' => $comment, 'commentData' => $commentData, 'commentNum' => $num[0], 'pagination' => $pagination]);
 }