public function destroy(Request $request, $id)
{
$comment = Comment::with('replies')->find($id);
// Do not recursively destroy children comments.
// Because 1. Soft delete feature was adopted,
// and 2. it's not just pleasant for authors of children comments to being deleted by the parent author.
if ($comment->replies->count() > 0) {
$comment->delete();
} else {
if ($comment->votes->count()) {
$this->deleteVote($comment->votes);
}
$comment->forceDelete();
}
// $this->recursiveDestroy($comment);
event(new ModelChanged('articles', 'comments'));
if ($request->ajax()) {
return response()->json('', 204);
}
flash()->success(trans('common.deleted'));
return back();
}