Esempio n. 1
0
 /**
  * Filter by tag
  *
  * @param Relations\HasMany $query
  * @param string            $tags
  *
  * @return void
  */
 public function filterTags(Relations\HasMany $query, $tags)
 {
     if (!empty($tags)) {
         $tagIds = array_map('trim', explode(',', $tags));
         $query->whereHas('tags', function (Eloquent\Builder $query) use($tagIds) {
             $query->whereIn('id', $tagIds);
         });
     }
 }