Answers for "updateorinsert laravel for large data"

PHP
0

updateorinsert laravel for large data

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.
Posted by: Guest on February-07-2022

Code answers related to "updateorinsert laravel for large data"

Browse Popular Code Answers by Language