laravel-tagging icon indicating copy to clipboard operation
laravel-tagging copied to clipboard

TaggingUtility::slug does not support UPPERCASE tags

Open visbits opened this issue 2 years ago • 3 comments

First off, THANK YOU, this tagging module is very useful and has been extensively implemented in my projects.

Couple issues I've found and started working on a branch with fixes but got deep in the weeds and realized a few things that I'll just itimize.

  1. line 75 of TaggingUtility references 'delimiter' => config('taggable.delimiter', '-'), should be 'delimiter' => config('tagging.delimiter', '-'),

  2. Adding support for uppercase tags looks like it was started at line 77 but upon further investigation the relationship model of tagging_tagged and tagging_tags relies on the tag_slug match which could become easily broken if one is manipulated without the other.

  3. I changed lowercase to false but in my database the tagging_tagged->tag_slug remains uppercase but tagging_tags->slug becomes Pascal...

I will continue to work on this and hopefully provide a PR unless you immediately know how to support retaining tags as uppercase.

Thanks!!!

visbits avatar Mar 09 '22 18:03 visbits

This is the most interesting ticket opened in a while. Thanks. I won't be able to dig into details on this until probably Saturday.

rtconner avatar Mar 09 '22 22:03 rtconner

@rtconner did you get a chance to poke at this? I got sidetracked by other things.

visbits avatar Mar 29 '22 14:03 visbits

I changed lowercase to false but in my database the tagging_tagged->tag_slug remains uppercase but tagging_tags->slug becomes Pascal...

I think this is not the correct way to do it.

You should php artisan vendor:publish --tag=config and then modify the 'normalizer' value in there. I believe this is the correct way to do it.

<?php

return [
	'normalizer' => 'strtoupper',
]

rtconner avatar Apr 25 '22 22:04 rtconner