cviebrock/eloquent-taggable

Detag on delete

pierrocknroll opened this issue · 2 comments

Hello,

It could be great for the database consistency to detag on a deleted model (if it is not soft deleted).

I think you can do something like :

static::deleting(function ($model) {
    if (!method_exists($model, 'runSoftDelete') || $model->isForceDeleting()) {
        $model->detag();
    }
});

Thanks

The main idea being that it would help clean up the polymorphic table, right?

I'd be totally open to a PR that did this, if you have time. 😉

Yeah, ok I'll do it !