Corcel\PostMeta::getValueAttribute PHP Method

getValueAttribute() public method

Tries to unserialize the object and returns the value if that doesn't work.
public getValueAttribute ( ) : value
return value
    public function getValueAttribute()
    {
        try {
            $value = unserialize($this->meta_value);
            // if we get false, but the original value is not false then something has gone wrong.
            // return the meta_value as is instead of unserializing
            // added this to handle cases where unserialize doesn't throw an error that is catchable
            return $value === false && $this->meta_value !== false ? $this->meta_value : $value;
        } catch (Exception $ex) {
            return $this->meta_value;
        }
    }