📜  laravel 模型插入多个 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:30.540000             🧑  作者: Mango

代码示例1
$data = [
    ['user_id'=>'Coder 1', 'subject_id'=> 4096],
    ['user_id'=>'Coder 2', 'subject_id'=> 2048],
    //...
];

Model::insert($data); // Eloquent approach
DB::table('table')->insert($data); // Query Builder approach