protected function addOneTag(string $tagName): void
    {
        /** @var Tag $tag */
        $tag = app(TagService::class)->findOrCreate($tagName);
        $tagKey = $tag->getKey();

        if (!$this->getAttribute('tags')->contains($tagKey)) {
            $this->tags()->attach($tagKey);
        }
    }
protected function addOneTag(string $tagName): void
    {
        /** @var Tag $tag */
        $tag = app(TagService::class)->findOrCreate($tagName);
        $tagKey = $tag->getKey();

        if (!$this->getAttribute('tags')->contains($tagKey)) {
            $this->tags()->attach($tagKey);
        }
    }
protected function addOneTag ( string $ tagName ) : void { /** @var Tag $tag */ $ tag = app ( TagService :: class ) -> findOrCreate ( $ tagName ) ; $ tagKey = $ tag -> getKey ( ) ; if ( ! $ this -> getAttribute ( 'tags' ) -> contains ( $ tagKey ) ) { $ this -> tags ( ) -> attach ( $ tagKey ) ; } }
Add one tag to the model.

@param string $tagName
Add one tag to the model .