Set a value for an attribute.
If a value already exists it will be replaced.
If the value is empty the attribute will be cleared/reset.

@param string $attribute
@param mixed $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;
    }
1255555
function addAttribute(Attribute $attribute)
    {
        $attribute->setRelation($this);
        $this->attributes[$attribute->getName()] = $attribute;
        return $this;
    }
665163
public function setAttribute($key, $value)
    {
        if ($this->hasSetMutator($key)) {
            $method = sprintf($this->methodNameSetMutator, Str::studly($key));

            return $this->{$method}($value);
        }

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

        return $this;
    }
1045060
public function filter($attribute, $value)
    {
        $filter = $attribute . ':' . (is_array($value) ? implode(',', $value) : $value);

        if ($this->offsetExists('filter')) {
            $filter = $this->offsetGet('filter') . ';' . $filter;
        }

        $this->offsetSet('filter', $filter);

        return $this;
    }
595087
public function setAttribute($name, $value = null)
    {
        if (is_array($name)) {
            foreach ($name as $key => $value) {
                $this->setAttribute($key, $value);
            }
        } else {
            $method = 'set'.ucfirst($name);
            if (method_exists($this, 'set'.ucfirst($name))) {
                $this->attributes[$name] = $this->{$method}($value);
            } else {
                $this->attributes[$name] = $value;
            }
        }

        return $this;
    }
542166
public function whereEquals($attribute, $value)
    {
        $this->data->must()->term($attribute, $value);

        return $this;
    }
8792
public function setAttribute($attribute, $value){
        if($attribute === 'table'){
            $this->_table = $value;
        }
        elseif($attribute === 'pk'){
            $this->_pk = $value;
        }
        elseif($attribute === 'relations'){
            $this->_relations = $value;
        }
        
        return $this;
    }
1274541
public function withAttribute($attribute, $value)
    {
        /** @var EvolvableLinkInterface $that */
        $that = clone($this);
        $that->attributes[$attribute] = $value;
        return $that;
    }
981631
public function setAttribute($name, $value) {
		if ($this->_attributes === null) {
			$this->initAttributes();
		}
		
		$this->_attributes[$name] = $value;
		
		$this->_xml->addAttribute($name, $value);
		
		return $this;
	}
846743
public function setAttribute($attribute, $value = null)
    {
        if ($attribute === 'class') {
            $this->addClass($value);

            return $this;
        }

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

        return $this;
    }
287702
public function setAttribute($attribute, $value)
    {
        if ($this->isTranslatable($attribute) && !empty($value)) {
            // If a translation code has not yet been set, generate one:
            if (!$this->translationCodeFor($attribute)) {
                $reflected                                    = new \ReflectionClass($this);
                $group                                        = 'translatable';
                $item                                         = strtolower($reflected->getShortName()) . '.' . strtolower($attribute) . '.' . Str::random();
                $this->attributes["{$attribute}_translation"] = "$group.$item";
            }
        }
        return parent::setAttribute($attribute, $value);
    }
1249417
public function reset($field = 'reset', $value = 'Reset', array $attributes = array())
	{
		if (is_array($field))
		{
			$attributes = $field;
		}
		else
		{
			$attributes['name'] = (string) $field;
			$attributes['value'] = (string) $value;
		}
		$attributes['type'] = 'reset';

		return $this->input($attributes);
	}
798834
public function setAttribute($attribute, $value) {
		if (!array_key_exists($attribute, $this->_readonlyAttributes)) {
			$this->_attributes[$attribute] = $value;
			return true;
		}

		return false;
	}
1366289
public function attribute($attribute, $value = null)
    {
        if (is_array($attribute)) {
            $this->attributes = array_merge($this->attributes, $attribute);
        } else {
            $this->attributes[$attribute] = (string) $value;
        }

        return $this;
    }
293661
public function addAttribute($attribute, $value)
    {
        $value = is_array($value) ? $value : [$value];

        if (!isset($this->attributes[$attribute])) {
            $this->attributes[$attribute] = [];
        }
        foreach ($value as $attrValue) {
            $this->attributes[$attribute][] = $attrValue;
        }

        return $this;
    }
688106
public function setAttributes($attributes)
    {
        if (! is_array($attributes)) {
            $attributes = [$attributes];
        }

        $this->attributes = $attributes;

        return $this;
    }
581861
public function attribute($key, $value = null) {
        if (is_array($key)) {
            $this->_attributes = array_replace($this->_attributes, $key);
        } else {
            $this->_attributes[$key] = $value;
        }

        return $this;
    }