Closed BSN4 closed 1 year ago
@josephmancuso @girardinsamuel
There's the model.update_or_create method, but it receives the wheres and the values to update, when replicate the example of link in laravel docs it becomes:
user.related("roles").update_or_create(wheres, updates)
The "wheres" argument, Isn't relation when called, redundant?
@Marlysson thanks didn't find it in the docs
@Marlysson can it be used outside relations though? like Order.update_or_create({})
@Marlysson can it be used outside relations though? like
Order.update_or_create({})
Yes
Describe the feature as you'd like to see it Some time you want either to update existing raw or create it .. awesome to have
UpdateOrCreate
What do we currently have to do now? https://laravel.com/docs/9.x/upgrade#belongs-to-many-first-or-new