original_string: public function prepareModelRelationships($relationships)
      {
          $relationshipMethods = '';
  
          foreach ($relationships as $relation) {
              if (!isset($relation[2])) {
                  $relationEnd = explode('\\', $relation[1]);
                  $relation[2] = strtolower(end($relationEnd));
              }
  
              $method = str_singular($relation[2]);
  
              if (stristr($relation[0], 'many')) {
                  $method = str_plural($relation[2]);
              }
  
              $relationshipMethods .= "\n\tpublic function ".$method.'() {';
              $relationshipMethods .= "\n\t\treturn \$this->$relation[0]($relation[1]::class);";
              $relationshipMethods .= "\n\t}\n\t";
          }
  
          return $relationshipMethods;
      }
code: public function prepareModelRelationships($relationships)
      {
          $relationshipMethods = '';
  
          foreach ($relationships as $relation) {
              if (!isset($relation[2])) {
                  $relationEnd = explode('\\', $relation[1]);
                  $relation[2] = strtolower(end($relationEnd));
              }
  
              $method = str_singular($relation[2]);
  
              if (stristr($relation[0], 'many')) {
                  $method = str_plural($relation[2]);
              }
  
              $relationshipMethods .= "\n\tpublic function ".$method.'() {';
              $relationshipMethods .= "\n\t\treturn \$this->$relation[0]($relation[1]::class);";
              $relationshipMethods .= "\n\t}\n\t";
          }
  
          return $relationshipMethods;
      }
code_tokens: public function prepareModelRelationships ( $ relationships ) { $ relationshipMethods = '' ; foreach ( $ relationships as $ relation ) { if ( ! isset ( $ relation [ 2 ] ) ) { $ relationEnd = explode ( '\\' , $ relation [ 1 ] ) ; $ relation [ 2 ] = strtolower ( end ( $ relationEnd ) ) ; } $ method = str_singular ( $ relation [ 2 ] ) ; if ( stristr ( $ relation [ 0 ] , 'many' ) ) { $ method = str_plural ( $ relation [ 2 ] ) ; } $ relationshipMethods .= "\n\tpublic function " . $ method . '() {' ; $ relationshipMethods .= "\n\t\treturn \$this->$relation[0]($relation[1]::class);" ; $ relationshipMethods .= "\n\t}\n\t" ; } return $ relationshipMethods ; }
docstring: Prepare a models relationships.
  
  @param array $relationships
  
  @return string
docstring_tokens: Prepare a models relationships .