original_string: public static function firstByTitleOrCreate($title, $locale = null)
      {
          $tag = Tag::whereTranslation('title', $title, $locale)->first();
  
          if (is_null($tag))
          {
              $attributes = compact('title');
  
              if ($locale)
              {
                  $attributes = [$locale => $attributes];
              }
  
              $tag = Tag::create($attributes);
          }
  
          return $tag;
      }
code: public static function firstByTitleOrCreate($title, $locale = null)
      {
          $tag = Tag::whereTranslation('title', $title, $locale)->first();
  
          if (is_null($tag))
          {
              $attributes = compact('title');
  
              if ($locale)
              {
                  $attributes = [$locale => $attributes];
              }
  
              $tag = Tag::create($attributes);
          }
  
          return $tag;
      }
code_tokens: public static function firstByTitleOrCreate ( $ title , $ locale = null ) { $ tag = Tag :: whereTranslation ( 'title' , $ title , $ locale ) -> first ( ) ; if ( is_null ( $ tag ) ) { $ attributes = compact ( 'title' ) ; if ( $ locale ) { $ attributes = [ $ locale => $ attributes ] ; } $ tag = Tag :: create ( $ attributes ) ; } return $ tag ; }
docstring: Finds a tag by title or creates it
  
  @param string $title
  @param string $locale
  @return Tag
docstring_tokens: Finds a tag by title or creates it