Exemple #1
0
 /**
  * Return an array of all of the tags that are in use by this model
  *
  * @return Collection
  */
 public static function existingTags()
 {
     return Tagged::distinct()->join('tagging_tags', 'tag_slug', '=', 'tagging_tags.slug')->where('taggable_type', '=', (new static())->getMorphClass())->orderBy('tag_slug', 'ASC')->get(array('tag_slug as slug', 'tag_name as name', 'tagging_tags.count as count'));
 }
Exemple #2
0
 public function scopeRelated($query, $tagNames)
 {
     // $tagNames = TaggingUtil::makeTagArray($tagNames);
     return Tagged::where('name', 'like', $tagNames . '%')->groupBy('tag_slug')->get(array('tag_slug as slug', 'tag_name as name'));
 }