Can you remove a model by id? The documentation says you need to pass in the model itself to remove it.
So I need to fetch the model first and then remove it? I can't just remove it by id?
Do you mean remove the model from a collection? Looking at the docs, it does seem like you need to pass in a real model, but the source code suggests that you can just pass in either the model id
or the model cid
as well, and all of the above should work (as well as arrays of all of the above).
So all of the following should be equivalent:
collection.remove(myModel); collection.remove(myModel.id); collection.remove(myModel.cid); collection.remove([myModel]);
I haven't tested this, however.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With