original_string: public function checkIfSlugIsUnique($slug)
      {
          $i = 0;
          $this->base_slug = $slug;
  
          while ($this->post->whereSlug($slug)->get()->count() > 0) {
              $i++;
              $slug = "$this->base_slug-$i";
          }
  
          return $slug;
      }
code: public function checkIfSlugIsUnique($slug)
      {
          $i = 0;
          $this->base_slug = $slug;
  
          while ($this->post->whereSlug($slug)->get()->count() > 0) {
              $i++;
              $slug = "$this->base_slug-$i";
          }
  
          return $slug;
      }
code_tokens: public function checkIfSlugIsUnique ( $ slug ) { $ i = 0 ; $ this -> base_slug = $ slug ; while ( $ this -> post -> whereSlug ( $ slug ) -> get ( ) -> count ( ) > 0 ) { $ i ++ ; $ slug = "$this->base_slug-$i" ; } return $ slug ; }
docstring: Check if a given slug already exists
  and when it exists generate a new one
  
  @param string $slug
  @return string
docstring_tokens: Check if a given slug already exists and when it exists generate a new one