protected function handleRecordCreation(array $data): Model { return auth()->user()->courses()->create($data); }
protected function handleRecordCreation(array $data): Model { return auth()->user()->courses()->create($data); }
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 !