public function deleteComment($comment_id) { $comment = Comment::findOrFail($comment_id); if ($comment->user_id != Auth::user()->id) { abort(403, 'unauthorized deletion'); } return json_encode(['success' => $comment->delete() ? 'true' : 'false']); }
public function destroy($id) { if (Request::ajax()) { $result['error'] = false; try { $comment = Comment::findOrFail($id); $comment->delete(); } catch (Exception $e) { $result['error'] = true; } return response()->json($result); } }
/** * Remove the specified resource from storage. * * @param int $idx * * @return Response */ public function destroy($idx) { $this->checkParametersEmpty(); $comment = Comment::findOrFail($idx); $comment->delete(); return $this->getCodeResponse(Response::HTTP_NO_CONTENT); }
/** * Get post slug. * * @param int $comment_id * @return string */ public function getSlug($comment_id) { return $this->comment->findOrFail($comment_id)->post->slug; }
/** * Destroy a comment if it exists. * * @param $id * @return Response */ public function destroy($id) { $comment = Comment::findOrFail($id); $comment::destroy($id); return redirect()->action('CommentController@index'); }
/** * Remove the specified resource from storage. * * @param int $id * * @return Response */ public function destroy($id) { $comment = Comment::findOrFail($id); $comment->delete(); return $this->getCodeResponse(Response::HTTP_NO_CONTENT); }
public function approved($id) { $comment = Comment::findOrFail($id); $this->authorize($comment); if ($comment->update(['status' => Comment::STATUS_ACTIVE])) { return response()->json(['status' => true]); } return response()->json(['status' => false])->setStatusCode(404); }