As user Xrymz suggested, DB::raw('LAST_INSERT_ID();') returns the first.
According to api scheme insertGetId() accepts an array
public int insertGetId(array $values, string $sequence = null)
So you should be able to do
DB::table('table')->insertGetId($arrayValues);
Saying if you are using MySQL, you can extract the first id and calculate the rest. There is also a function DB::getPdo()->lastInsertId(); which may help.
Or, if he returned the last identifier using some of these methods, you can also calculate it back to the first.
EDIT
According to the comments, my suggestions may be wrong.
Regarding the question of what, if a row is inserted by another user between them, it depends on the storage mechanism. If you use a table-level locking mechanism (MyISAM, MEMORY, and MERGE), the question does not matter, because it cannot have two simultaneous entries in the table.
If the row-level locking mechanism (InnoDB) is used, then another option would be to simply insert the data and then retrieve all the rows with some known field using the whereIn() method or define table-level locking .
source share