cviebrock/eloquent-taggable

Get Model by tag_id

rationalthinker1 opened this issue · 1 comments

I have a tag_id of a tag that I want to delete. I need the $model for me to detag it. Something like this below.

$tag = Tag::find("tag_id");
$model = $tag->taggable;
$model->tags()->detach( $tag );

You would need to set the taggedModels configuration.

That said, it would probably be nice to add a $tagService->deleteTag(...) method that removed the tag and also detagged all the attached models. I'll figure something out shortly.