getValue() . ' '; } else { $set_sql .= '? '; $bindings[] = $item[$u_col]; } } $set_sql .= 'ELSE `' . $u_col . '` END '; $sets[] = $set_sql; } $update_sql .= implode(', ', $sets); $where_in = collect($list_item)->pluck($reference_col)->values()->all(); $bindings = array_merge($bindings, $where_in); $where_in = rtrim(str_repeat('?,', count($where_in)), ','); $update_sql = rtrim($update_sql, ', ') . ' WHERE `' . $reference_col . '` IN (' . $where_in . ')'; // $count += DB::update($update_sql, $bindings); } return $count; } }