Looking at line 52 we find:
$names = $this->columnize(array_keys($values[0]));
This is used to build the column list part of the query (INSERT INTO (column1, column2) VALUES...
)
$values
is in your case $users
, but it does not have a 0
index. Why?
while ($i++ < 50)
increments $i before entering the loop body so the first index of $users
will be 1
, not 0
as the Laravel SQLite insert
implementation needs.
Fix it like this:
$i = 0;
while ($i < 49) {
...
$i++;
}
Why does the MySQL implementation work? This is what the corresponding line looks like in this implementation:
$columns = $this->columnize(array_keys(reset($values)));