$value) { if (is_string($value)) { $result->$field = trim(preg_split('/[^\r\n\t\x20-\x7E\xA0-\xFF]/', $value)[0]); } } return $result; }, $results); return $results; }*/ /** * Process an "insert get ID" query. * * @param \Illuminate\Database\Query\Builder $query * @param string $sql * @param array $values * @param string $sequence * @return int/array */ public function processInsertGetId(Builder $query, $sql, $values, $sequence = null) { $sequenceStr = $sequence ?: 'id'; if (is_array($sequence)) { $grammar = new DB2Grammar; $sequenceStr = $grammar->columnize($sequence); } $sql = 'select ' . $sequenceStr . ' from new table (' . $sql; $sql .= ')'; $results = $query->getConnection()->select($sql, $values); if (is_array($sequence)) { return array_values((array) $results[0]); } else { $result = (array) $results[0]; $id = $result[$sequenceStr]; return is_numeric($id) ? (int) $id : $id; } } }