protected function setEntityAttributeValue(Attribute $attribute, $value)
    {
        if (! is_null($value) && ! $value instanceof Value) {
            $model = Attribute::getTypeModel($attribute->getAttribute('type'));
            $instance = new $model();

            $instance->setAttribute('entity_id', $this->getKey());
            $instance->setAttribute('entity_type', $this->getMorphClass());
            $instance->setAttribute($attribute->getForeignKey(), $attribute->getKey());
            $instance->setAttribute('content', $value);

            $value = $instance;
        }

        return $this->setRelation($attribute->getAttribute('slug'), $value);
    }
protected function setEntityAttributeValue(Attribute $attribute, $value)
    {
        if (! is_null($value) && ! $value instanceof Value) {
            $model = Attribute::getTypeModel($attribute->getAttribute('type'));
            $instance = new $model();

            $instance->setAttribute('entity_id', $this->getKey());
            $instance->setAttribute('entity_type', $this->getMorphClass());
            $instance->setAttribute($attribute->getForeignKey(), $attribute->getKey());
            $instance->setAttribute('content', $value);

            $value = $instance;
        }

        return $this->setRelation($attribute->getAttribute('slug'), $value);
    }
protected function setEntityAttributeValue ( Attribute $ attribute , $ value ) { if ( ! is_null ( $ value ) && ! $ value instanceof Value ) { $ model = Attribute :: getTypeModel ( $ attribute -> getAttribute ( 'type' ) ) ; $ instance = new $ model ( ) ; $ instance -> setAttribute ( 'entity_id' , $ this -> getKey ( ) ) ; $ instance -> setAttribute ( 'entity_type' , $ this -> getMorphClass ( ) ) ; $ instance -> setAttribute ( $ attribute -> getForeignKey ( ) , $ attribute -> getKey ( ) ) ; $ instance -> setAttribute ( 'content' , $ value ) ; $ value = $ instance ; } return $ this -> setRelation ( $ attribute -> getAttribute ( 'slug' ) , $ value ) ; }
Set the entity attribute value.

@param \Rinvex\Attributes\Models\Attribute $attribute
@param mixed                               $value

@return $this
Set the entity attribute value .