original_string: protected function getForeignKeyNamesForRelation(Relation $relation)
      {
          if (    $relation instanceof BelongsTo
              ||  $relation instanceof HasOne
              ||  $relation instanceof HasMany
              ||  is_a($relation, '\\Znck\\Eloquent\\Relations\\BelongsToThrough', true)
          ) {
              return [ $relation->getForeignKey() ];
          }
  
          if ($relation instanceof BelongsToMany) {
              return [ $relation->getQualifiedForeignPivotKeyName(), $relation->getQualifiedRelatedPivotKeyName() ];
          }
  
          if (    $relation instanceof MorphTo
              ||  $relation instanceof MorphOne
              ||  $relation instanceof MorphMany
          ) {
              return [ $relation->getForeignKey(), $relation->getMorphType() ];
          }
  
          if ($relation instanceof MorphToMany) {
              return [
                  $relation->getQualifiedForeignPivotKeyName(),
                  $relation->getMorphType(),
                  $relation->getQualifiedRelatedPivotKeyName(),
              ];
          }
  
          return [];
      }
code: protected function getForeignKeyNamesForRelation(Relation $relation)
      {
          if (    $relation instanceof BelongsTo
              ||  $relation instanceof HasOne
              ||  $relation instanceof HasMany
              ||  is_a($relation, '\\Znck\\Eloquent\\Relations\\BelongsToThrough', true)
          ) {
              return [ $relation->getForeignKey() ];
          }
  
          if ($relation instanceof BelongsToMany) {
              return [ $relation->getQualifiedForeignPivotKeyName(), $relation->getQualifiedRelatedPivotKeyName() ];
          }
  
          if (    $relation instanceof MorphTo
              ||  $relation instanceof MorphOne
              ||  $relation instanceof MorphMany
          ) {
              return [ $relation->getForeignKey(), $relation->getMorphType() ];
          }
  
          if ($relation instanceof MorphToMany) {
              return [
                  $relation->getQualifiedForeignPivotKeyName(),
                  $relation->getMorphType(),
                  $relation->getQualifiedRelatedPivotKeyName(),
              ];
          }
  
          return [];
      }
code_tokens: protected function getForeignKeyNamesForRelation ( Relation $ relation ) { if ( $ relation instanceof BelongsTo || $ relation instanceof HasOne || $ relation instanceof HasMany || is_a ( $ relation , '\\Znck\\Eloquent\\Relations\\BelongsToThrough' , true ) ) { return [ $ relation -> getForeignKey ( ) ] ; } if ( $ relation instanceof BelongsToMany ) { return [ $ relation -> getQualifiedForeignPivotKeyName ( ) , $ relation -> getQualifiedRelatedPivotKeyName ( ) ] ; } if ( $ relation instanceof MorphTo || $ relation instanceof MorphOne || $ relation instanceof MorphMany ) { return [ $ relation -> getForeignKey ( ) , $ relation -> getMorphType ( ) ] ; } if ( $ relation instanceof MorphToMany ) { return [ $ relation -> getQualifiedForeignPivotKeyName ( ) , $ relation -> getMorphType ( ) , $ relation -> getQualifiedRelatedPivotKeyName ( ) , ] ; } return [ ] ; }
docstring: Returns the foreign key names for a given relation class.
  
  For BelongsToMany, this returns the key to the local model first, the other model second.
  For Morph relations, this will return the id/key and type column names.
  For MorphToMany the morph keys are followed by the other foreign key.
  
  @param Relation $relation
  @return string[]
docstring_tokens: Returns the foreign key names for a given relation class .