For updateOrCreate I suggest work the example from documentation to get a better understanding of how it works.
Also look it up in the API to further study it's inner workings:
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
If I need the upsert function but I'm using Laravel 6. Is my only option to use a foreach loop and individually insert the rows using something like updateOrCreate ?
Because I get an array from the request:
['id_x' => 'data', 'id_y' => 'data']
And I need to either insert each value to a new row, or update the row if the id exists
Please or to participate in this conversation.