how to insert multiple data at a time with create method in laravel
snippet in php

how to insert multiple data at a time with create method in laravel

user3619

$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