cartalyst / tags

A Tagging package that easily allows you to add tags to your Eloquent models.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What would be the best approach to heirarchical tagging

alnutile opened this issue · comments

Seems tags just be associated to tags, but just wanted to see if I was missing something.

For example

Foo
--bar
--baz

$tag = Tag::find(1) //foo
$tag->setTags('bar', 'baz');

// Get the entity object
$product = Product::find(1);

// Through a string
$product->setTags('bar');

Not truly heirarchical but help me to know what tags are in Foo and if needed find products under Foo by getting all Foo tags and then products with one of those tags.

Thanks
Al

We actually thought about having something similar to this not so long ago, but we never got into implementing it as the need for that kinda disappeared, at least for now.

The way we were thinking was to have a parent_id column, but it just an idea, we never got into testing if it would work as expected and if it would bring up weird issues.

so we would basically alter the migration, and on the Tags class make a parents function to reference this field, and a children function to make the reverse of that relationship?

Thanks for getting back to me

@alnutile Yes, that in theory should work.