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();
}
/** * Sync tag relation adding new tags as needed * * @param array $tags */ public function syncTags(array $tags) { $news = new News(); $news->syncTags($tags); }