- $url = "/ajax/page/$page->id/comment/";
- $request = [
- 'text' => $comment->text,
- 'html' => $comment->html
- ];
- if (!empty($parentCommentId)) {
- $request['parent_id'] = $parentCommentId;
- }
- $this->call('POST', $url, $request);
-
- $createdComment = $this->checkResponse();
- return $createdComment;
- }
-
- private function updateComment($comment) {
- $tmpComment = factory(Comment::class)->make();
- $url = '/ajax/page/' . $comment['page_id'] . '/comment/ ' . $comment['id'];
- $request = [
- 'text' => $tmpComment->text,
- 'html' => $tmpComment->html
- ];
-
- $this->call('PUT', $url, $request);
-
- $updatedComment = $this->checkResponse();
- return $updatedComment;
- }
-
- private function deleteComment($commentId) {
- // Route::delete('/ajax/comment/{id}', 'CommentController@destroy');
- $url = '/ajax/comment/' . $commentId;
- $this->call('DELETE', $url);
-
- $deletedComment = $this->checkResponse();
- return $deletedComment;
- }
-
- private function checkResponse() {
- $expectedResp = [
- 'status' => 'success'
- ];