bulk insert in laravel 5.6 code example
Example 1: insert batch in laravel
$data = [
['name' => 'John', 'age' => 25],
['name' => 'Maria', 'age' => 31],
['name' => 'Julia', 'age' => 55],
];
DB::table('table_name')->insert($data);
Example 2: insert batch in laravel
$data = array(
array('name'=>'Coder 1', 'rep'=>'4096'),
array('name'=>'Coder 2', 'rep'=>'2048'),
//...
);
Coder::insert($data);