public function build(Entity $entity): void
    {
        $attributes = $entity->getEntityAttributes();

        // We will manually add a relationship for every attribute registered
        // of this entity. Once we know the relation method we have to use,
        // we will just add it to the entityAttributeRelations property.
        foreach ($attributes as $attribute) {
            $relation = $this->getRelationClosure($entity, $attribute);

            $entity->setEntityAttributeRelation($attribute->getAttribute('slug'), $relation);
        }
    }
public function build(Entity $entity): void
    {
        $attributes = $entity->getEntityAttributes();

        // We will manually add a relationship for every attribute registered
        // of this entity. Once we know the relation method we have to use,
        // we will just add it to the entityAttributeRelations property.
        foreach ($attributes as $attribute) {
            $relation = $this->getRelationClosure($entity, $attribute);

            $entity->setEntityAttributeRelation($attribute->getAttribute('slug'), $relation);
        }
    }
public function build ( Entity $ entity ) : void { $ attributes = $ entity -> getEntityAttributes ( ) ; // We will manually add a relationship for every attribute registered // of this entity. Once we know the relation method we have to use, // we will just add it to the entityAttributeRelations property. foreach ( $ attributes as $ attribute ) { $ relation = $ this -> getRelationClosure ( $ entity , $ attribute ) ; $ entity -> setEntityAttributeRelation ( $ attribute -> getAttribute ( 'slug' ) , $ relation ) ; } }
Build the relations for the entity attributes.

@param \Illuminate\Database\Eloquent\Model $entity

@return void
Build the relations for the entity attributes .