Limiting number of records in .with()

Hi, I am querying for a list of forums and for each forum I want to get the last post.

This is my code

var forums = await Forum
      .withCount('posts', (builder) => {
      .withCount('posts as replies_count', (builder) => {
      .with('posts', (builder) => {
          .orderBy('created_at', 'desc')
      .where('active', 1)

I thought that by using limit(1) I would get 1 post per forum, but in fact, it returns one post full stop and that is assigned to the first forum record and all other forums say there are no posts.

How do I get just the last post with each forum?