rtconner / laravel-tagging

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

Tags versionning #61

Closed younes0 closed 9 years ago

younes0 commented 9 years ago

What if this library could allow this:

$model->setTagsVersion('machine');

// TaggedTrait.php
public function setTagsVersion($verison)
{
    $this->tagsVersion = $version;
}

// filter rows based on "version" tagged column 
public function tagged()
{
    $relation = $this->morphMany('Conner\Tagging\Tagged', 'taggable');
    // not sure if $morphMany accepts where chaining method
    return ($this->version) ? $relation->where('version', $this->tagsVersion) : $relation;
}
rtconner commented 9 years ago

I don't think I want to add this. It does not seem like a common enough use case to include in the library.

If you need this feature, you should probably just copy code from this library into your application, and modify it to suite your needs.

younes0 commented 9 years ago

you're right, thanks for your feedback, I might fork the library to add this feature