UpdateorInSert Laravel dla dużych danych
DB::table('flights')->upsert([
['departure' => 'Oakland', 'destination' => 'San Diego', 'price' => 99],
['departure' => 'Chicago', 'destination' => 'New York', 'price' => 150]
], ['departure', 'destination'], ['price']);
The upsert method will insert records that do not exist and update the records
that already exist with new values that you may specify. The method's first
argument consists of the values to insert or update, while the second argument
lists the column(s) that uniquely identify records within the associated
table. The method's third and final argument is an array of columns that
should be updated if a matching record already exists in the database.
Lokesh003