Upgrade to 3.0.2
This commit is contained in:
@@ -73,7 +73,7 @@ class Collection extends BaseCollection
|
||||
*/
|
||||
public function __set(string $id, $object)
|
||||
{
|
||||
$this->data[$object->id()] = $object;
|
||||
$this->data[$id] = $object;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,14 +81,16 @@ class Collection extends BaseCollection
|
||||
* an entire second collection to the
|
||||
* current collection
|
||||
*
|
||||
* @param mixed $item
|
||||
* @param mixed $object
|
||||
*/
|
||||
public function add($object)
|
||||
{
|
||||
if (is_a($object, static::class) === true) {
|
||||
$this->data = array_merge($this->data, $object->data);
|
||||
} else {
|
||||
} elseif (method_exists($object, 'id') === true) {
|
||||
$this->__set($object->id(), $object);
|
||||
} else {
|
||||
$this->append($object);
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
Reference in New Issue
Block a user