protected function getPivotValues(string $relation, InternallyMappable $entity): array
    {
        $values = [];

        $entityAttributes = $entity->getEntityAttributes();

        if (array_key_exists($relation, $this->pivotAttributes)) {
            foreach ($this->pivotAttributes[$relation] as $attribute) {
                if (array_key_exists($attribute, $entityAttributes)) {
                    $values[$attribute] = $entity->getEntityAttribute('pivot')->$attribute;
                }
            }
        }

        return $values;
    }
protected function getPivotValues(string $relation, InternallyMappable $entity): array
    {
        $values = [];

        $entityAttributes = $entity->getEntityAttributes();

        if (array_key_exists($relation, $this->pivotAttributes)) {
            foreach ($this->pivotAttributes[$relation] as $attribute) {
                if (array_key_exists($attribute, $entityAttributes)) {
                    $values[$attribute] = $entity->getEntityAttribute('pivot')->$attribute;
                }
            }
        }

        return $values;
    }
protected function getPivotValues ( string $ relation , InternallyMappable $ entity ) : array { $ values = [ ] ; $ entityAttributes = $ entity -> getEntityAttributes ( ) ; if ( array_key_exists ( $ relation , $ this -> pivotAttributes ) ) { foreach ( $ this -> pivotAttributes [ $ relation ] as $ attribute ) { if ( array_key_exists ( $ attribute , $ entityAttributes ) ) { $ values [ $ attribute ] = $ entity -> getEntityAttribute ( 'pivot' ) -> $ attribute ; } } } return $ values ; }
Get pivot attributes for a relation.

@param string             $relation
@param InternallyMappable $entity

@return array
Get pivot attributes for a relation .