Make sure sync() always works with arrays.
This commit is contained in:
@@ -121,6 +121,7 @@ class Has_Many_And_Belongs_To extends Relationship {
|
|||||||
public function sync($ids)
|
public function sync($ids)
|
||||||
{
|
{
|
||||||
$current = $this->pivot()->lists($this->other_key());
|
$current = $this->pivot()->lists($this->other_key());
|
||||||
|
$ids = (array) $ids;
|
||||||
|
|
||||||
// First we need to attach any of the associated models that are not currently
|
// 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
|
// in the joining table. We'll spin through the given IDs, checking to see
|
||||||
|
|||||||
Reference in New Issue
Block a user