/**
  * Save topic's tags
  *
  * @param int $topicId
  * @param array $tags
  */
 public function setTags($topicId, array $tags)
 {
     Topic\Tag::where('topic_id', $topicId)->delete();
     foreach ($tags as $name) {
         $tag = Tag::firstOrCreate(['name' => $name]);
         Topic\Tag::create(['topic_id' => $topicId, 'tag_id' => $tag->id]);
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     \Coyote\Tag::create(['name' => 'php']);
     \Coyote\Tag::create(['name' => 'python']);
     \Coyote\Tag::create(['name' => 'c']);
     \Coyote\Tag::create(['name' => 'c#']);
     \Coyote\Tag::create(['name' => 'c++']);
     \Coyote\Tag::create(['name' => 'java']);
     \Coyote\Tag::create(['name' => 'ruby']);
     \Coyote\Tag::create(['name' => 'delphi']);
     \Coyote\Tag::create(['name' => 'pascal']);
 }
 /**
  * Save microblog's tags
  *
  * @param int $microblogId
  * @param array $tags
  */
 public function setTags($microblogId, array $tags)
 {
     Microblog\Tag::where('microblog_id', $microblogId)->delete();
     foreach ($tags as $name) {
         $tag = Tag::firstOrCreate(['name' => $name]);
         Microblog\Tag::create(['microblog_id' => $microblogId, 'tag_id' => $tag->id]);
     }
 }