rtconner / laravel-tagging

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

Tag Events have no reference to Tagged/Tag #163

Closed Firtzberg closed 5 years ago

Firtzberg commented 5 years ago

Tagging related events provide only the taggable object that got tagged/untagged. Since a taggable object can have multiple tags it is unknown which Tag was added/removed. The Events should also carry a reference to the added/removed Tag or Tagged.

Firtzberg commented 5 years ago

It should be possible to extend the tag events with the tagName. This would preserve backwards compatibility.

rtconner commented 5 years ago

Ok thanks, this is reasonable. Will add this.

rtconner commented 5 years ago

Man the documentation on this was so terrible. I fixed that also.

Anyways, I could not do the tagged on the remove event, but I did add the tagSlug to the event object. I hope that gives you what you needed. I didn't want to run an extra query to give you the instance. I figure it's just as easy to do that inside your listener.

Take a look, and re-open this if it does not meet your needs. - https://github.com/rtconner/laravel-tagging/blob/laravel-5/docs/events.md

This is in v3.2.1