Question about implementing Has Many fields on a Runway blueprint #458
-
DescriptionHi. I was having some trouble getting a Has Many field working on one of my Runway blueprints. When attempting to create a new child record via the Has Many field, I kept getting a MySQL error that the foreign ID didn’t have a default value; presumably because it was not being set. The only way I could get the Has Many field to work was to implement a BelongsTo field on the related model’s blueprint. Is it a requirement to implement both Has Many and Belongs To fields on each respective blueprint? Or should the Has Many field alone be capable of creating related models? My HasMany/BelongsTo eloquent relationship is pretty standard; both relationships are configured correctly in the respective model classes. I’m just trying to gage if I’ve messed something up on my end regarding the Runway implementation. Thanks for any guidance here. EnvironmentEnvironment Cache Drivers Statamic Statamic Addons |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Can you share what your blueprint & eloquent model look like? |
Beta Was this translation helpful? Give feedback.
Right now, I think relationship fields on both sides are needed. You might be able to hide the field if you don't want it showing though:
Although, I would consider a pull request making it so relationships aren't needed on both sides, since you don't need both sides for a normal Eloquent relationships.