diff --git a/laravel/database/eloquent/relationships/has_many_and_belongs_to.php b/laravel/database/eloquent/relationships/has_many_and_belongs_to.php index 1c0d3e03..ee37ca2e 100644 --- a/laravel/database/eloquent/relationships/has_many_and_belongs_to.php +++ b/laravel/database/eloquent/relationships/has_many_and_belongs_to.php @@ -121,6 +121,7 @@ class Has_Many_And_Belongs_To extends Relationship { public function sync($ids) { $current = $this->pivot()->lists($this->other_key()); + $ids = (array) $ids; // First we need to attach any of the associated models that are not currently // in the joining table. We'll spin through the given IDs, checking to see