rtconner / laravel-tagging

Tag support for Laravel Eloquent models - Taggable Trait
MIT License
882 stars 168 forks source link

Updating tag #183

Closed casperwilkes closed 1 year ago

casperwilkes commented 4 years ago

Great package! I'm running into an issue with updating a tag. Maybe it's an architecture thing I'm missing conceptually? If you try to update a tag, it creates a new one instead of updating the current record.

It looks like you have to update both tagging_tags and tagging_tagged in order for an update to occur. Is there not an easier way to update both records in 1 call?

KhurshidYakubov commented 3 years ago

$post->untag(); // first, remove old tags $post->tag($tags); // second, add new tags $post->save; // and update

rtconner commented 1 year ago

see also the retag method