$rows) { $imported[$table] = 0; foreach ($rows as $row) { try { static::insert_row($table, $row); } catch (QueryException $e) { if ($ignore_errors) { continue; } throw $e; } ++$imported[$table]; } } return $imported; } /** * @param $table * @param $row * @return mixed * @throws \Exception */ public static function insert_row($table, $row) { # encrypt any password fields if (array_key_exists('password', $row)) { $row['password'] = bcrypt($row['password']); } # if any time fields are == to "now", then insert the right time foreach ($row as $column => $value) { if (strtolower($value) === 'now') { $row[$column] = static::time(); } } try { DB::table($table)->insert($row); } catch (QueryException $e) { Log::error($e); throw $e; } return $row; } }