Set an encrypted value for an encryptable attribute.

@param string $attribute name
@param string $value     to encrypt
332428
public function setEncryptingAttribute($attribute, $value)
    {
        array_set($this->attributes, $attribute, $this->encrypt($value));
    }
775546
public function setItemAttribute(string $attribute, string $value = '')
    {
        $this->applyToAll(function (HasHtmlAttributes $link) use ($attribute, $value) {
            $link->setAttribute($attribute, $value);
        });

        return $this;
    }
460969
public function setAttribute($key, $value)
    {
        parent::setAttribute($key, $value);
        if ($this->isAesCastable($key, $this->getTable())) {
            $this->attributes[$key] = Cryptor::getInstance()->crypt('encrypt', $value);
        }
        return $this;
    }
414583
protected function modifyAttributeValue(string $attribute, $value)
    {
        $attributeModifiers = $this->getAttributeModifiers();

        if (!array_key_exists($attribute, $attributeModifiers)) {
            return $value;
        }

        $attributeModifier = $attributeModifiers[$attribute];

        if (is_subclass_of($attributeModifier, AttributeRedactor::class)) {
            return call_user_func([$attributeModifier, 'redact'], $value);
        }

        if (is_subclass_of($attributeModifier, AttributeEncoder::class)) {
            return call_user_func([$attributeModifier, 'encode'], $value);
        }

        throw new AuditingException(sprintf('Invalid AttributeModifier implementation: %s', $attributeModifier));
    }
1324899
public function setAttr($attribute, $value = null)
    {
        if (is_array($attribute) && is_null($value)) {
            foreach ($attribute as $k => $v) {
                $this->setAttr($k, $v);
            }

            return $this;
        }
        $this->template->appendHTML('attributes', ' '.$attribute.'="'.$value.'"');

        return $this;
    }
13403
public function set($attribute, $value)
    {
        if ($value === [] || $value === '' || $value === null) {
            return $this->reset($attribute);
        }

        if ($this->has($attribute)) {
            $attribute = $this->resolveAttributeName($attribute);
            $this->attributes[$attribute] = $value;
        } else {
            $this->attributes[$attribute] = $value;
        }
        $this->batches->add(new Batch(Batch::TYPE['REPLACE'], $attribute, $value));

        return $this;
    }
999252
def write_encrypted_attribute(attr_name, to_attr_name, cipher_class, options)
        value = send(attr_name)
        
        # Only encrypt values that actually have content and have not already
        # been encrypted
        unless value.blank? || value.encrypted?
          callback("before_encrypt_#{attr_name}")
          
          # Create the cipher configured for this attribute
          cipher = create_cipher(cipher_class, options, value)
          
          # Encrypt the value
          value = cipher.encrypt(value)
          value.cipher = cipher
          
          # Update the value based on the target attribute
          send("#{to_attr_name}=", value)
          
          callback("after_encrypt_#{attr_name}")
        end
      end
415528
public function setNewValue($attribute, $value)
    {
        $this->assertValidAttribute($attribute);

        $this->documentChangeSet[$attribute][1] = $value;
        $this->getDocumentManager()->getUnitOfWork()->setDocumentChangeSet($this->getDocument(), $this->documentChangeSet);
    }
850295
public function setAttribute($attribute, $value)
    {
        if (parent::setAttribute($attribute, $value)) {
            $this->options[$attribute] = $value;
            return true;
        }
        return false;
    }
785588
public function setAttribute($key, $value)
    {
        if ($this->isEnumAttribute($key)) {
            $enumClass = $this->getEnumClass($key);
            if (! $value instanceof $enumClass) {
                $value = new $enumClass($value);
            }

            $this->attributes[$key] = $value->value();

            return $this;
        }

        parent::setAttribute($key, $value);
    }
1287174
public function setPasswordAttribute($value)
    {
        if (strlen($value)) {
            $this->attributes['password'] = Hash::make($value);
            if ($this->id) {
                activity()->on($this)->log(ActivityLog::ACTION_UPDATED_PASSWORD);
            }
        }
    }
488517
public function set($attribute, $value = null)
    {
        parent::set($this->getRealKey($attribute), $value);
    }
461287
public function attr($attribute, $value)
    {
        $this->setOption(self::OPTION_METHOD, "attr");
        $this->setOption(self::OPTION_ATTR, $attribute);
        $this->setOption(self::OPTION_VALUE, $value);

        return $this;
    }
846743
public function setAttribute($attribute, $value = null)
    {
        if ($attribute === 'class') {
            $this->addClass($value);

            return $this;
        }

        $this->attributes[$attribute] = $value;

        return $this;
    }
950664
public function set($attribute, $value)
    {
        if (!in_array($attribute, static::$allowedAttributes)) {
            return false;
        }
        $this->attributes[$attribute] = $value;
    }
1292589
public function removeAttributeValue(string $attribute, string $value): self
    {
        // Only remove value if attribute is present
        if (! array_key_exists($attribute, $this->attributes)) {
            return $this;
        }

        // Remove the value from the attribute
        $values = array_filter(
            $this->getAttribute($attribute),
            function ($attributeValue) use ($value) {
                return $attributeValue !== $value;
            }
        );

        // Stores the new values
        $this->setAttribute($attribute, $values);

        return $this;
    }
21549
public function set($attribute, $value)
    {
        list($relationArray, $column, $jsonArray) = FieldNameSlicer::split($attribute);
        $column = $jsonArray ? ($column . '->' . join('->', $jsonArray)) : $column;

        if (count($relationArray) === 0) {
            $this->data->setAttribute($column, $value);

            return;
        }

        $relation = join('.', $relationArray);
        $related = $this->data->getRelationValue($relation);
        if ($related && $related instanceof Model) {
            $related->setAttribute($column, $value);
            $this->relations[$relation] = $related;
        }
    }