Relationship "id", fillable and saveRelationships
Hi everyone,
There is probably something I misuderstand. I have a "Course" entity and a "CourseCategory" entity. My relationship is as simple as :
In my CourseResource I have the following select :
And in my CreateCourse :
But if I submit my form, I always get "Field 'course_category_id' doesn't have a default value". The issue disappears if I add "course_category_id" in the $fillable of Course, but I do not like that idea.
I'm seeing there is the "saveRelationships(); " who is called automatically, but I'm not sure to see how it works because if I add course_category_id in the $fillable, it is totally useless, and if not, I have the issue shown above.
Can someone help me understand what's the best way to deal with that ?
Thanks !
There is probably something I misuderstand. I have a "Course" entity and a "CourseCategory" entity. My relationship is as simple as :
In my CourseResource I have the following select :
And in my CreateCourse :
But if I submit my form, I always get "Field 'course_category_id' doesn't have a default value". The issue disappears if I add "course_category_id" in the $fillable of Course, but I do not like that idea.
I'm seeing there is the "saveRelationships(); " who is called automatically, but I'm not sure to see how it works because if I add course_category_id in the $fillable, it is totally useless, and if not, I have the issue shown above.
Can someone help me understand what's the best way to deal with that ?
Thanks !