public static function add($body, $authorable, $commentable, $parentId = 0, $status = 'show') { $comment = new Comment(); $comment->body = $body; $comment->authorable_id = $authorable->id; $comment->authorable_type = get_class($authorable); $comment->commentable_id = $commentable->id; $comment->commentable_type = get_class($commentable); $comment->parent_id = $parentId; $comment->status = $status; $comment->save(); return $comment; }
public function addComment($body, $commentable, $parentId = 0, $status = 'show') { return Comment::add($body, $this, $commentable, $parentId, $status); }