/** * Delete comment * * @param $commentId * @return \Illuminate\Http\RedirectResponse */ public function delete($commentId) { if ($page = $this->ensure('admin')) { return $page; } $this->commentService->delete($commentId); return redirect()->back(); }
/** * Vote comment * * @param integer $comment * @param Request $request * @return mixed */ public function vote($comment, Request $request) { $this->validate($request, ['value' => 'required|in:-1,0,1']); $comment = $this->comment->findById($comment, $this->currentUser); if (!$comment) { throw new NotFoundHttpException(); } $value = $request->get('value'); return $this->commentService->vote($this->currentUser, $comment, $value); }