I am trying to insert bulk data in a model using Eloquent ORM. I have created an array of arrays like following:
$data array(
array('email' => 'taylor@example.com', 'votes' => 0),
array('email' => 'dayle@example.com', 'votes' => 0),
//...
)
I have a model say ModelA
and I am trying to insert data in the model as follows:
ModelA::insert($data);
No syntax errors are showing up and no data is being inserted in the table. Could you please help with what could be the reason?
Also if I use this:
DB::table('tableX')->insert($data)
And there is no table named tableX
or there is a typo in the table name still I don't get any errors. Is this normal. I am using Laravel 4.2.
Surprisingly this code works on my friend's system. I am not able to figure out the root cause of the problem.