Does the add function exist for the Users object? I cannot see anything in the docs, and thought it might’ve been omitted. Or is there a way to achieve a similar thing with user collections?
No, add()
does not exist for other collections. You could try $collection->append()
.
Or mimic the add()
method:
$users->data[$additionalUser->username()] = $additionalUser
But $users->append($additionalUser->username(), $additionalUser)
should be sufficient in most cases, I guess.