Pixelairport's avatar

MorphToMany not saving pivot data in nova

Hi. I use Nova and have this in my resource:

MorphToMany::make('Contacts')->fields(function () {
                return [
                    Select::make('Type', 'type')
                        ->options([
                            'company',
                            'other'
                        ])
                        ->required(),
                ];
            })->searchable(),

It is also show and seems to work as expected. But the value is not saved in my pivot table. Does anybody have an idea? thx

0 likes
1 reply
Pixelairport's avatar
Pixelairport
OP
Best Answer
Level 12

Ok. I found the problem. I had to rename "type" in to something else like "contact_type" in my mysql table.

Please or to participate in this conversation.