Ejemplo n.º 1
0
 /**
  * Private! Please do not call this function directly, just let the Tag library use it.
  * Increment count of tag by one. This function will create tag record if it does not exist.
  *
  * @param string $tagString
  */
 public static function incrementCount($tagString, $tagSlug, $count)
 {
     if ($count <= 0) {
         return;
     }
     $tag = Tag::where('slug', '=', $tagSlug)->first();
     if (!$tag) {
         $tag = new Tag();
         $tag->name = $tagString;
         $tag->slug = $tagSlug;
         $tag->suggest = false;
         $tag->save();
     }
     $tag->count = $tag->count + $count;
     $tag->save();
 }
Ejemplo n.º 2
0
 public function testCreate()
 {
     $tag = new Tag();
     $tag->name = 'Some Tag';
     $tag->save();
     $this->assertInternalType('string', $tag->slug);
     $this->assertInternalType('int', $tag->id);
 }