public function setDepthAttribute()
 {
     if ($this->attributes['parent'] == 0) {
         $depth = 0;
     } else {
         $parentComment = Comment::find($this->parent);
         $depth = $parentComment->attributes['depth'] + 1;
     }
     $this->attributes['depth'] = $depth;
 }
 public function edit($object_id, $comment_id)
 {
     $comment = Comment::find($comment_id);
     // Make sure that the request for editing is from the user who owns the comment
     // and isn't already trashed
     if ($comment->user_id == Auth::id() && !$comment->trashed()) {
         $comment->comment = Input::get('comment.comment');
         $comment->save();
         return response()->json($comment, 200);
     }
     return response()->json(null, 402);
 }