src/Conductors/Concerns/DisassociatesAbilities.php
protected function getRelationKeyNames(MorphToMany $relation)
    {
        // We need to get the keys of both tables from the relation class.
        // The method names have changed in Laravel 5.4 & again in 5.5,
        // so we will first check which methods are available to us.
        if (method_exists($relation, 'getForeignKey')) {
            return [
                $relation->getForeignKey(),
                $relation->getOtherKey(),
            ];
        }

        if (method_exists($relation, 'getQualifiedForeignKeyName')) {
            return [
                $relation->getQualifiedForeignKeyName(),
                $relation->getQualifiedRelatedKeyName(),
            ];
        }

        return [
            $relation->getQualifiedForeignPivotKeyName(),
            $relation->getQualifiedRelatedPivotKeyName(),
        ];
    }
protected function getRelationKeyNames(MorphToMany $relation)
    {
        // We need to get the keys of both tables from the relation class.
        // The method names have changed in Laravel 5.4 & again in 5.5,
        // so we will first check which methods are available to us.
        if (method_exists($relation, 'getForeignKey')) {
            return [
                $relation->getForeignKey(),
                $relation->getOtherKey(),
            ];
        }

        if (method_exists($relation, 'getQualifiedForeignKeyName')) {
            return [
                $relation->getQualifiedForeignKeyName(),
                $relation->getQualifiedRelatedKeyName(),
            ];
        }

        return [
            $relation->getQualifiedForeignPivotKeyName(),
            $relation->getQualifiedRelatedPivotKeyName(),
        ];
    }
protected function getRelationKeyNames ( MorphToMany $ relation ) { // We need to get the keys of both tables from the relation class. // The method names have changed in Laravel 5.4 & again in 5.5, // so we will first check which methods are available to us. if ( method_exists ( $ relation , 'getForeignKey' ) ) { return [ $ relation -> getForeignKey ( ) , $ relation -> getOtherKey ( ) , ] ; } if ( method_exists ( $ relation , 'getQualifiedForeignKeyName' ) ) { return [ $ relation -> getQualifiedForeignKeyName ( ) , $ relation -> getQualifiedRelatedKeyName ( ) , ] ; } return [ $ relation -> getQualifiedForeignPivotKeyName ( ) , $ relation -> getQualifiedRelatedPivotKeyName ( ) , ] ; }
Get the two primary key names from the relation.

@param  Illuminate\Database\Eloquent\Relations\MorphToMany  $relation
@return array
Get the two primary key names from the relation .