epartment / nova-dependency-container

A Laravel Nova field container allowing to depend on other fields values
MIT License
382 stars 163 forks source link

Nova depency container breaks benjaco/belongs-to-many #112

Open YarinceP opened 4 years ago

YarinceP commented 4 years ago

Hi thanks for the Awesome package! :100: I'm trying to use benjacho/belongs-to-many inside a NovaDepencyContainer. A few issues I've found:

There is a weird error when trying to create or update a record and the belongs-to-many field is wrapped in a NovaDepencyContainer. It appears that the field is treated as a column rather than a pivot (belongs to many, so there's no "column" to create or update).This ONLY happens when the field is wrapped in a NovaDepencyContainer.

Could you help me please?

Benjacho commented 4 years ago

Hey i added dependency on original repo!

abdallah84 commented 4 years ago

@Benjacho How to use nova-dependency with yours belongs-to-many ?

noahlocke commented 4 years ago

@Benjacho or @wize-wiz any chance we can get these two to play nice? Two very awesome packages!

Benjacho commented 4 years ago

I added this in my repo BelongsTo::make('Association', 'association', 'App\Nova\Association'), BelongsToManyField::make('Participants', 'participant', 'App\Nova\Participant') ->dependsOn('association', 'association_id'),

Method dependsOn is similar that is used in this repo, until this moment we only support belongsTo fields as a dependency

skoyah commented 4 years ago

I've tinkered around and I found a solution that works.

the HasDependencies trait has the following method:

Screenshot 2020-07-31 at 14 06 53

Let me know if it helps.

noahlocke commented 4 years ago

Thanks @skoyah, will try this out!