How can we perform bulk database insertions in Laravel using Eloquent ORM?
I want to accomplish this in Laravel: https://stackoverflow.com/a/10615821/600516 but I am getting the following error.
SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters.
You can just use Eloquent::insert()
.
For example:
$data = array(
array('name'=>'Coder 1', 'rep'=>'4096'),
array('name'=>'Coder 2', 'rep'=>'2048'),
//...
);
Coder::insert($data);