📜  如何使用 laravel 在 mysql 中插入多行 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:15.829000             🧑  作者: Mango

代码示例1
/*
It is really easy to do a bulk insert in Laravel with or without the query builder.
You can use the following official approach.
*/


Entity::upsert([
    ['name' => 'Pierre Yem Mback', 'city' => 'Eseka', 'salary' => 10000000],
    ['name' => 'Dial rock 360', 'city' => 'Yaounde', 'salary' => 20000000],
    ['name' => 'Ndibou La Menace', 'city' => 'Dakar', 'salary' => 40000000]
], ['name', 'city'], ['salary']);