I, I worked on the same thing a few days ago,
eloquent makes several attachments in one sql.
but make sure that all loops are equal to columns and fields, I tried to delete the one that doesn't matter the first time, and mysql doesn't work ...
eg:
array( array('name' => 'blah'), array('name' => 'blah') ) User::insert($data)
but if you want to update existing records, you need to execute a raw query.
eg:
$keyString = '("'; $valString = '("'; foreach ($blah as $k => $v) { $keyString .= $k . '", ' }
The goal is to return something like this
$keyString // (name, email, bla, bla) $valString // ('john doe', ' email@email.com ', 'bla', 'bla'), ('someone', ' email@email.com ', 'bla', 'bla'),
than
DB::query( 'replace into users' . $keyString . ' values ' . $valString );
make sure you use array counting to check if the last array is a comma or not
eg:
(++counter === count ? '),' : ')' ;
this need to reorganize