src/Models/PolyfillTrait.php
public function setAttribute($key, $value)
	{
		$type = $this->hasCast($key) ? $this->getCastType($key) : null;
		if (!empty($type) && !$this->hasSetMutator($key)  && !in_array($type, $this->originalCastTypes))
		{
			$method = 'from'.Str::studly($type);
			if (method_exists($this, $method))
				$value = call_user_func([$this, $method], $value, $key, $type);
		}
		return parent::setAttribute($key, $value);
	}
public function setAttribute($key, $value)
	{
		$type = $this->hasCast($key) ? $this->getCastType($key) : null;
		if (!empty($type) && !$this->hasSetMutator($key)  && !in_array($type, $this->originalCastTypes))
		{
			$method = 'from'.Str::studly($type);
			if (method_exists($this, $method))
				$value = call_user_func([$this, $method], $value, $key, $type);
		}
		return parent::setAttribute($key, $value);
	}
Set a given attribute on the model.

@param  string  $key
@param  mixed  $value
@return $this