rtconner / laravel-tagging

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

Different Tags for different model types #83

Closed unitedworx closed 5 years ago

unitedworx commented 8 years ago

Hi Rob, first of all congrats on the wonderful package, nice work you have done there! I was wondering if there is an easy way to have your package maintain different set of tags depending on the model type. E.g you want to use or suggest different set of tags for the blog of your website and different tags for the products of your website. Effectively when saving or retrieving tags to suggest specify if it's for products or blog or anything else you want.

rtconner commented 8 years ago

Maybe. There are two features .. that sort of do this ..

Article::existingTags(); // return collection of all existing tags on any articles

and then https://github.com/rtconner/laravel-tagging/blob/laravel-5/docs/suggesting.md

Do those cover what you need, or what kind of code were you hoping to have for this?

unitedworx commented 8 years ago

This does not really do this. it simply allows you to have tags that get suggested or not. what i am looking for is to Have different sets of Suggested Tags and make sure that e.g a tag called "New" under products and a tag called "New" under Blog have different id and slug since they belong to different sets.

Or i could use my own Tag Model ( I think i read somewhere i can! ) and simply add a type field and in my ui only suggest tags of that type! also i could make sure that when i create new tags they get assigned the correct type. probably the type can be the model::class automatically! the sort of thing that happens when you use polymorphic relations :) so basically i need polymorphic tags :)

WolfieZero commented 8 years ago

:+1:

thaonguyen90 commented 8 years ago

An article has many different types of tags seem do not apply. Table tagging_tags more to differentiate the type.

rtconner commented 5 years ago

Tag groups hopefully solve this. Please re-open if not.