Skip to content

Commit 712c88a

Browse files
committed
Fix ids being converted to int
1 parent 4526972 commit 712c88a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Jenssegers/Mongodb/Relations/BelongsToMany.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ public function sync($ids, $detaching = true)
126126
{
127127
$this->detach($detach);
128128

129-
$changes['detached'] = (array) array_map(function ($v) { return (int) $v; }, $detach);
129+
$changes['detached'] = (array) array_map(function ($v) {
130+
return is_numeric($v) ? (int) $v : (string) $v;
131+
}, $detach);
130132
}
131133

132134
// Now we are finally ready to attach the new records. Note that we'll disable

0 commit comments

Comments
 (0)