public function deleteComment($id) { $comment = ForumComment::find($id); if ($comment == null) { return Redirect::route('forum')->with('fail', "That comment does not exist."); } $threadid = $comment->thread->id; if ($comment->delete()) { return Redirect::route('forum-thread', $threadid)->with('success', "The comment was deleted."); } else { return Redirect::route('forum-thread', $threadid)->with('fail', "An error occured while deleting the comment."); } }
public function deleteComment($id) { $comment = ForumComment::find($id); $threadId = $comment->thread_id; if ($comment == null) { # code... Redirect::route('forum-home')->with('fail', "The comment is not Available anymore"); } if ($comment->delete()) { # code... return Redirect::route('forum-thread', $threadId)->with('success', "Comment has been successfully deleted"); } else { return Redirect::route('forum-thread', $threadId)->with('fail', "Something went wrong while deleting"); } }