rtconner / laravel-tagging

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

Enhance: Limit or slice maximum allowed number of tags during assigning #176

Closed hasnatbabur closed 4 years ago

rtconner commented 4 years ago

Wow interesting. I never thought people would tag with 1000's of tags at one time. Is that what you are doing?

hasnatbabur commented 4 years ago

Actually not. But a feature request to set limit such as max 3 tags allowed out of the box. Please ignore. Thanks

rtconner commented 4 years ago

Oh like a config value?

hasnatbabur commented 4 years ago

@rtconner When we extract tag names from string or collection then limit those total tag number to say 3. We will have a helper chain function like ->limit() before attaching tags to Posts. We can have also a default max value in config file.

It is just an enhancement thought from me. I saw often some website only allows max 3 or five tags.

Thanks again.

rtconner commented 4 years ago

For behavior, should it throw an exception if you go over the limit, or should it just only add the 3 values?

hasnatbabur commented 4 years ago

@rtconner Thanks for reply. Sorry I was away. Ideally if if one do not set limit value in config file or run time then let's add as much as given tags. But limit if valid limit (integer) value is set in config or set by a method during run time. It will be more feature full this way I think. Thanks again.