public static function destroy($ids)
{
$ids = is_array($ids) ? $ids : func_get_args();
$ids = array_map(function ($value) {
return $value instanceof MongoID ? $value : new MongoID($value);
}, $ids);
$instance = new static();
// We will actually pull the models from the database table and call delete on
// each of them individually so that their events get fired properly with a
// correct set of attributes in case the developers wants to check these.
$key = $instance->getKeyName();
foreach ($instance->whereIn($key, $ids)->get() as $model) {
$model->delete();
}
}