public function actionComments($id, $type = 'user') { User::getUserInfoOrRedirect($this, $id, $user, $isMyProfile); $request = Yii::$app->request; $comments = \app\models\Comments::getComments($id, $type, 20, $request->post('contentId'), $request->post('contentType')); if ($request->isAjax) { echo json_encode(['content' => $comments]); return; } return $this->render('comments', ['user' => $user, 'isMyProfile' => $isMyProfile, 'comments' => $comments, 'type' => $type]); }