How to save morphToMany relationship during create?
Hi, I'm getting the error "Integrity constraint violation: 1048 Column 'categorizable_id' cannot be null" when laravel tries to run
The model has the following:
And the filament resource form has:
Obviously, the relationship can't be saved till after the parent Content model has been saved, but this seems be trying to do that in the reverse order.
Any idea how to get round this? I can't believe I'm the first person to encounter this, so it feels like something I've set up wrong.
Andy
Solution:Jump to solution
Hmm. That's really wierd. I've just created a test app with the same models, and it works fine.
OK, so something odd about my setup, so I'll look into it further. Appreciate your help, @toeknee...
5 Replies
categorizable_id isn't being set, it's passed as null. Are you using the createoptionform first?
No, the categories already exist in this case, and I'm tyring to add the relationship at the same time:
This is a standard resource with a standard create page?
Yes
Solution
Hmm. That's really wierd. I've just created a test app with the same models, and it works fine.
OK, so something odd about my setup, so I'll look into it further. Appreciate your help, @toeknee