Adds a CardAttribute to the card.

@param CardAttribute|Closure $attribute
@return $this
489013
public function addAttribute($attribute)
    {
        if ($attribute instanceof CardAttribute) {
            $this->attributes[] = $attribute;

            return $this;
        }

        if ($attribute instanceof Closure) {
            $attribute($new = new CardAttribute());
            $this->attributes[] = $new;

            return $this;
        }

        throw new InvalidArgumentException(
            'Invalid attribute type. Expected '.CardAttribute::class.' or '.Closure::class.'.'
        );
    }
49676
protected function editFieldhandlerAttribute($attribute)
    {
        $field_name = 'field_' . $attribute;

        $this->$field_name = null;

        if (isset($this->field[$attribute])) {
            $this->$field_name = $this->field[$attribute];

            return $this;
        }

        if ($attribute === 'value') {
            $this->$field_name = null;
            return $this;
        }

        throw new InvalidArgumentException(
            'No field ' . $attribute . ' passed into '
            . get_class($this)
            . ' FieldhandlerUsageTrait::editFieldhandlerAttribute '
        );
    }
354671
public function addAttributeValue(string $attribute, string $value = ''): self
    {
        // Retrieve the current values of the attribute
        $values = $this->getAttribute($attribute);

        // Merge the values
        if (! in_array($value, $values)) {
            $values[] = $value;
        }

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

        return $this;
    }
322662
public function removeAttribute(string $attribute): self
    {
        // Determine if the attribute is present, unset if present
        if (array_key_exists($attribute, $this->attributes)) {
            unset($this->attributes[$attribute]);
        }

        return $this;
    }
970182
public function remember($attribute, $closure)
    {
        $key = $attribute.'_'.$this->location;

        if (!Cache::has($key)) {
            $result = $closure();
            Cache::forever($key, $result);
        }

        return Cache::get($key);
    }
710115
public function updateCardFromStripe()
    {
        $defaultCard = $this->defaultCard();

        if ($defaultCard) {
            $this->fillCardDetails($defaultCard)->save();
        } else {
            $this->forceFill([
                'card_brand' => null,
                'card_last_four' => null,
            ])->save();
        }

        return $this;
    }
727199
public function replaceHtmlAttribute($key, $attribute)
    {
        $attribute                  = $this->prepareHtmlAttributeValue($attribute);
        $this->htmlAttributes[$key] = $attribute;

        return $this;
    }
225603
protected function takeAttributeFromDOM($attribute)
    {
        switch ($attribute->localName) {
        case 'state':
            $this->_state = $attribute->nodeValue;
            break;
        default:
            parent::takeAttributeFromDOM($attribute);
        }
    }
1050551
public function sync_original_attribute( $attribute ) {
		if ( array_key_exists( $attribute, $this->attributes ) ) {
			$this->original[ $attribute ] = $this->attributes[ $attribute ];
		}

		return $this;
	}
877664
public function set_attr( $attribute, $value = null ) {
		if ( is_null( $value ) || $value === false ) {
			if ( array_key_exists( $attribute, $this->attr ) ) {
				unset( $this->attr[$attribute] );
			}
		} else {
			if ( $value === true ) {
				$value = $attribute;
			}
			$this->attr[ $attribute ] = $value;
		}
		
		return $this;
	}
510698
public function setItemParentAttribute(string $attribute, string $value = '')
    {
        $this->applyToAll(function (HasParentAttributes $item) use ($attribute, $value) {
            $item->setParentAttribute($attribute, $value);
        });

        return $this;
    }
138463
public function removeAttribute(Attribute $attribute)
    {
        foreach ($this->attributes as $key => $attributeElement) {
            if ($attributeElement === $attribute) {
                unset($this->attributes[$key]);
                break;
            }
        }

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

            return $this;
        }

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

        return $this;
    }
851286
public function registerCustomAttributes($attributes) 
    {
        if( is_string($attributes) ) {
            $attributes = explode(' ',$attributes);
        }
        $this->customAttributes = array_merge( $this->customAttributes , (array) $attributes );
        return $this;
    }
470318
public function addMany(array $attributes)
    {
        if (count($attributes) > 0) {
            foreach($attributes as $name => $value) {
                $this->add($name, $value);
            }
        }

        return $this;
    }
363529
public function append($attributes)
    {
        $this->appends = array_unique(
            array_merge($this->appends, is_string($attributes) ? func_get_args() : $attributes)
        );

        return $this;
    }
1006936
public function addAttributes(array $attributes): self
    {
        $this->attributes = array_unique(array_merge($this->attributes, $attributes));

        return $this;
    }