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 [];
    }