public function getAttribute($key)
    {
        if (array_key_exists($key, $this->attributes))
        {
            $value = $this->attributes[$key];

            if (in_array($key, $this->getDates()))
            {
                return $this->asDateTime($value);
            }

            return $value;
        }
    }
public function getAttribute($key)
    {
        if (array_key_exists($key, $this->attributes))
        {
            $value = $this->attributes[$key];

            if (in_array($key, $this->getDates()))
            {
                return $this->asDateTime($value);
            }

            return $value;
        }
    }
public function getAttribute ( $ key ) { if ( array_key_exists ( $ key , $ this -> attributes ) ) { $ value = $ this -> attributes [ $ key ] ; if ( in_array ( $ key , $ this -> getDates ( ) ) ) { return $ this -> asDateTime ( $ value ) ; } return $ value ; } }
Get an attribute from the relation.

@param  string  $key
@return mixed
Get an attribute from the relation .