Create Form -- Picker for BelongsToMany Relationship

I have a belongsToMany relationship setup between bookings and services. In essence, a booking hasMany services and a service hasMany bookings. They are then connected through a booking_services table.

That said, when I go to add a service to a booking via our Forest Admin, I’m presented with the “Create Service” form whereas what I really want is a picker that lets me choose from the services in our database.

Is this functionality supported? And, if so, how would I go about implementing this feature on our Forest Dashboard?

Thanks in advance!
Eric

EDIT
kk – I’ve found a solution for this issue. Instead of using a belongsToMany relationship to display services on a booking, I’m using the hasMany relationship to the booking_services model. That way, Forest lets me create a booking_service attaching the two together. This solves the underlying issue of letting admins manage those relationships.

1 Like

Hi @ehubbell,
Welcome to the Forest Admin community!

Great to read that you find a solution that fits your needs.

However, in you initial models declaration (bookings.belongsToMany(services)), you should see 2 options by default in the creation button dropdown (“Create a new service”, “Add an existing service”).
See the example below:
Screenshot 2020-08-07 at 08.59.56

Feel free to share a screencast or some screenshots to let us dig into this.