Insert doesn't return anything but a success boolean, so I think your only option is to query your table before the insert to find the max id, then count your $data array with count(), and determine the to-be ids with that.
There might be a more semantic way to do this...but I think this will work (untested).
$data = array(
array('name'=>'Bar', 'lastname'=>'Baz'),
array('name'=>'Foo', 'lastname'=>'Baz'),
);
$max_id = DB::table('users')->max('id');
$ids = array();
foreach ($data as $i => $row) /* assuming non-associative keys, and that at least one record already exists */
{
$ids[] = $max_id + $i + 1;
}
YourModel::insert($data);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community