src/Services/TagService.php
public function findOrCreate(string $tagName): Tag
    {
        $tag = $this->find($tagName);

        if (!$tag) {
            $tag = $this->tagModel::create(['name' => $tagName]);
        }

        return $tag;
    }
public function findOrCreate(string $tagName): Tag
    {
        $tag = $this->find($tagName);

        if (!$tag) {
            $tag = $this->tagModel::create(['name' => $tagName]);
        }

        return $tag;
    }
Find an existing tag (or create a new one) by name.

@param string $tagName

@return Tag