nova-inline-relationship icon indicating copy to clipboard operation
nova-inline-relationship copied to clipboard

Implement BelongsToMany Relationship

Open brandonferens opened this issue 5 years ago • 2 comments

brandonferens avatar Dec 05 '19 17:12 brandonferens

will this get an update, or is it dead? :(

genesiscz avatar Apr 23 '20 18:04 genesiscz

I'd like inline capabilities for BelongsToMany relationships too. There are some packages around, but they either don't support pivot fields (attaching / detaching only), assume that there will always be an id field on the pivot table (we usually just have a two-column primary key) or assume that models have an integer as primary key (we usually have UUIDs). Also, I really like this packages approach with using the native Nova relation field and adding the inline() method to them.

I've looked into what would be needed to add support for BelongsToMany to this package:

  1. As @yiukamsum already found out and proposed, there will need to be a BelongsToManyObserver to handle the server side requirements.
  2. I experimented with the observer and while I did no longer get the 'this relation is not supported'-exception, the form renders in a way that is suitable to adding new objects (like you would with HasMany) instead of syncing with existing objects. Conclusion: the frontend needs significant work too.

As syncing with existing objects is so different from the relationships this package currently supports, I'm starting to doubt if BelongsToMany support should even be part of it. I'd like to know how maintainers of and significant contributors to this package think about that, before further action.

JeroenVanOort avatar Dec 22 '23 12:12 JeroenVanOort