public function attribute($key, $value)
    {
        if (! in_array($key, $this->allowedAttributes)) {
            throw new InvalidArgumentException("Attribute [{$key}] does not exist.");
        }

        $this->attributes[Arr::get($this->aliases, $key, $key)] = $value;

        return $this;
    }
public function attribute($key, $value)
    {
        if (! in_array($key, $this->allowedAttributes)) {
            throw new InvalidArgumentException("Attribute [{$key}] does not exist.");
        }

        $this->attributes[Arr::get($this->aliases, $key, $key)] = $value;

        return $this;
    }
public function attribute ( $ key , $ value ) { if ( ! in_array ( $ key , $ this -> allowedAttributes ) ) { throw new InvalidArgumentException ( "Attribute [{$key}] does not exist." ) ; } $ this -> attributes [ Arr :: get ( $ this -> aliases , $ key , $ key ) ] = $ value ; return $ this ; }
Set the value for a given attribute.

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

@throws \InvalidArgumentException
Set the value for a given attribute .