public function actionComment($cid) { $idu = Yii::$app->user->getId(); $uid = new components\UserId($idu); $comment = PostsService::getCommentById($cid); $nothing = $comment->getAuthor(); $commentOwner = $nothing->getId(); //die(var_dump($commentOwner)); if (!Yii::$app->user->can('admin')) { if ($commentOwner != $idu) { return $this->redirect('/intouch/accessdenied'); } } if (Yii::$app->request->isPost) { try { $id = Yii::$app->request->post('comment_id'); $comment = PostsService::getCommentById($id); $comment->changeContent(Yii::$app->request->post('inputContent')); PostsService::saveComment($comment); } catch (exception $e) { } EventService::createEvent(components\EEvent::ACCOUNT_INFO_CHANGED(), $uid); Yii::$app->session->setFlash('success', 'Comment\'s been Succesfuly Updated'); return $this->redirect('/profile'); } return $this->render('comment', ['comment' => $comment]); }