Closed jasondavis closed 5 years ago
I had this same issue about a year ago on 1.1.
I wasn't confident with adding to the project -but might make a fork over the weekend.
What I did was make my own trait TaggableTraitExtended and overrode the following three method: tag($tagNames, $user), addTag($tagName, $user), existingTags($$userOnly=false).
Send me a PM if you want some source code with it.
Hi @Drozes Can you share the own trait that you have made with me? I will really appreciate it. Thanks in advance
Any update regarding this issue? I was trying to implement this feature
@Drozes Awesome would you care to share your Trait with us, seems there is a demand for this feature!
You could just write your own static existingTags method in your taggable model:
public static function existingUserTags(User $user) {
return \Conner\Tagging\Model\Tagged::distinct()
->join('tagging_tags', 'tag_slug', '=', 'tagging_tags.slug')
->where('taggable_type', '=', (new static)->getMorphClass())
->join('bookmarks', 'taggable_id', '=', 'bookmarks.id')
->where('bookmarks.user_id', $user->id)
->orderBy('tag_slug', 'ASC')
->get(array('tag_slug as slug', 'tag_name as name', 'tagging_tags.count as count'));
}
I am building a bookmarking service similar to Pinboard. My main entity is Bookmarks which can use this library to add tagging to the bookmarks.
My issue is that when I return all bookmarks with a tag, I need it to return only those matching bookmarks for that tag but also limit to the current users ID on those bookmark and tag tables.
Is it possibble to use this on a per user basis?