Skip to content

Commit 452ef9f

Browse files
committed
Added string key as $index un "update" function
1 parent 28c4c64 commit 452ef9f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/LaravelBatch.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
class Batch
99
{
1010
/**
11-
* Update Multi fields
12-
* $table String
13-
* $value Array
14-
* $index String
11+
* Update multiple rows
12+
* @param string $table Table
13+
* @param array $values Values
14+
* @param string $index Index
1515
*
1616
* Example
1717
*
@@ -31,6 +31,7 @@ class Batch
3131
*
3232
* $index = 'id';
3333
*
34+
* @return mixed
3435
*/
3536
public function update($table, $values, $index)
3637
{
@@ -62,7 +63,7 @@ public function update($table, $values, $index)
6263
. 'ELSE `'.$k.'` END), ';
6364
}
6465

65-
$query = "UPDATE `$table` SET " . substr($cases, 0, -2) . " WHERE `$index` IN(" . implode(',', $ids) . ");";
66+
$query = "UPDATE `$table` SET " . substr($cases, 0, -2) . " WHERE `$index` IN(" . '"' . implode('","', $ids) . '"' . ");";
6667

6768
return DB::statement($query);
6869
}

0 commit comments

Comments
 (0)