You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I think It would be really great to have something like updateOrCreateMany method on relationship. Right now I have this code: foreach ($request->translations as $translation) { if (!$product->translation()->exists()) { $product->translation()->create($translation); } else { $product->translation()->update($translation); } }
and I think to have something like $product->translation()->updateOrCreateMany($request->translations) would be really great. It works when I use only CreateMany, but I can not use it to update currentdata, so this is only working solution I found.
Thanks for your answear and maybe possibillity to implement this method.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, I think It would be really great to have something like updateOrCreateMany method on relationship. Right now I have this code:
foreach ($request->translations as $translation) { if (!$product->translation()->exists()) { $product->translation()->create($translation); } else { $product->translation()->update($translation); } }
and I think to have something like
$product->translation()->updateOrCreateMany($request->translations)
would be really great. It works when I use onlyCreateMany
, but I can not use it to update currentdata, so this is only working solution I found.Thanks for your answear and maybe possibillity to implement this method.
Beta Was this translation helpful? Give feedback.
All reactions