protected function doUpdate($id = null, $data = null, bool $allowNullId = false): bool
{
$escape = $this->escape;
$this->escape = [];
$builder = $this->builder();
if ($id === null && ! $allowNullId && empty($builder->getCompiledQBWhere())) {
throw new DatabaseException(
'Updates are not allowed unless they contain a "where" or "like" clause.'
);
}
if ($id) {
$builder = $builder->whereIn($this->table . '.' . $this->primaryKey, $id);
}
// Must use the set() method to ensure to set the correct escape flag
foreach ($data as $key => $val) {
$builder->set($key, $val, $escape[$key] ?? null);
}
return $builder->update();
}