Skip to content

Commit c1fbb26

Browse files
authored
Add check value in batch update
check is null
1 parent b65b7c3 commit c1fbb26

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/LaravelBatch.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public function update($table, $values, $index)
4949
{
5050
if ($field !== $index)
5151
{
52-
$final[$field][] = 'WHEN `'. $index .'` = "' . $val[$index] . '" THEN "' . $val[$field] . '" ';
52+
$value = (is_null($val[$field]) ? 'NULL' : '"' . $val[$field] . '"' );
53+
$final[$field][] = 'WHEN `'. $index .'` = "' . $val[$index] . '" THEN ' . $value . ' ';
5354
}
5455
}
5556
}

0 commit comments

Comments
 (0)