Default values on pivot table for attach/save
Hi, is there any way to set default values for the pivot table for attach and save? So rather than having to write
Foo::things()->attach(2, ['bar' => 'baz']);
every time when 'bar' == 'baz' most of the time, is there any way to set bar to baz by default if it's not set? I tried overriding the attach() method in the model, but then realized I can't do that since the attach() method is in the relationship class, not the Model class. Is there anywhere the attach() method can be extended/overriden or where default values can be set?
Want to reply to this thread?Login with github.