Most people probably figure this out on their own but I am a total noob so I will give this question a shot for the sake of other noobs.
I am trying to set up laravel-tagging, a tagging system for Laravel framework, which probably has a similar structure to any other tagging system. It comes with 2 tables:
Field Type Null Key Default Extra
'id', 'int(10) unsigned', 'NO', 'PRI', NULL, 'auto_increment'
'taggable_id', 'int(10) unsigned', 'NO', 'MUL', NULL,
'taggable_type', 'varchar(255)', 'NO', 'MUL', NULL,
'tag_name', 'varchar(255)', 'NO', NULL,
'tag_slug', 'varchar(255)', 'NO', 'MUL', NULL,
Polymorphic Relation and this relation allow a model to belong to more than one other model on a single association.
Imagin you have
Comment models and them both can have
You have to use only one table for both.
taggable_id column will have the ID value of the post or comment, while the
taggable_type column will contain the class name of the owning model