src/Discussion/Discussion.php
public function mergePost(MergeableInterface $post)
    {
        $lastPost = $this->posts()->latest()->first();

        $post = $post->saveAfter($lastPost);

        return $this->modifiedPosts[] = $post;
    }
public function mergePost(MergeableInterface $post)
    {
        $lastPost = $this->posts()->latest()->first();

        $post = $post->saveAfter($lastPost);

        return $this->modifiedPosts[] = $post;
    }
public function mergePost ( MergeableInterface $ post ) { $ lastPost = $ this -> posts ( ) -> latest ( ) -> first ( ) ; $ post = $ post -> saveAfter ( $ lastPost ) ; return $ this -> modifiedPosts [ ] = $ post ; }
Save a post, attempting to merge it with the discussion's last post.

The merge logic is delegated to the new post. (As an example, a
DiscussionRenamedPost will merge if adjacent to another
DiscussionRenamedPost, and delete if the title has been reverted
completely.)

@param \Flarum\Post\MergeableInterface $post The post to save.
@return Post The resulting post. It may or may not be the same post as
was originally intended to be saved. It also may not exist, if the
merge logic resulted in deletion.
Save a post attempting to merge it with the discussion s last post .