cviebrock / eloquent-taggable

Easily add the ability to tag your Eloquent models in Laravel.
MIT License
537 stars 72 forks source link

The tag model doesn't prevent duplicates #99

Closed philippejadin closed 4 years ago

philippejadin commented 5 years ago

As far as I can tell, I can create multiple tags using the tag model with the same normalized name. It would be nice to disallow this at the db level (in the migration?) or at least on the model when it is saved.

Can be done? should be done?

Thanks you!

judgej commented 5 years ago

I'm looking at the database structure and there are a number of issues that should be fixed to maintain data integrity:

Just allowing the migration file to be published would be a great first move here, then we can add and modify the indexes we like.

On a side note, the naming conventions for the primary key and foreign keys don't follow Laravel conventions, and this means workarounds and more time needed to understand what the database structure is.

Apart from that - it's the best tagging plugin by far :-)

mateusjunges commented 4 years ago

@philippejadin @judgej @cviebrock Are you working on this? I have some free time and if you agree, I can send a PR fixing this issue

judgej commented 4 years ago

I've not got any spare time for the next month at least. I'll fork this package if any of this becomes a blocker, then see what can be worked back in later.

mateusjunges commented 4 years ago

@judgej I'll work on that. I will be happy if you got some time to review my PR when it is ready.

mateusjunges commented 4 years ago

@judgej I just opened the PR for this issue. You can check if you want.

judgej commented 4 years ago

That's a great load of fixes. I'll aim to give it a try later today.

cviebrock commented 4 years ago

Version 6.0.2 should solve most of these issues.