Ejemplo n.º 1
0
 /**
  * Sync tag relation adding new tags as needed
  *
  * @param array $tags
  */
 public function syncTags(array $tags)
 {
     Tag::addNeededTags($tags);
     if (count($tags)) {
         $this->tags()->sync(Tag::whereIn('tag', $tags)->lists('id')->all());
         return;
     }
     $this->tags()->detach();
 }