Skip to content

Commit 3979320

Browse files
committed
Handle single model in sync method;
1 parent f5ed7bf commit 3979320

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Relations/BelongsToMany.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ public function sync($ids, $detaching = true)
117117

118118
if ($ids instanceof Collection) {
119119
$ids = $ids->modelKeys();
120+
} elseif ($ids instanceof Model) {
121+
$ids = $this->parseIds($ids);
120122
}
121123

122124
// First we need to attach any of the associated models that are not currently

0 commit comments

Comments
 (0)