private function fetchValueForKey($key, $value)
    {
        if (in_array($key, $this->getDates())) {
            return trim($value) === '' ? null : $value;
        }

        if (! $this->hasSetMutator($key)) {
            $value = $this->getAttribute($key);
        }

        if ($this->isJsonCastable($key) && ! is_null($value)) {
            $value = is_string($value) ? $this->getJsonCastValue($value) : $value;
        }

        return $value;
    }
private function fetchValueForKey($key, $value)
    {
        if (in_array($key, $this->getDates())) {
            return trim($value) === '' ? null : $value;
        }

        if (! $this->hasSetMutator($key)) {
            $value = $this->getAttribute($key);
        }

        if ($this->isJsonCastable($key) && ! is_null($value)) {
            $value = is_string($value) ? $this->getJsonCastValue($value) : $value;
        }

        return $value;
    }
private function fetchValueForKey ( $ key , $ value ) { if ( in_array ( $ key , $ this -> getDates ( ) ) ) { return trim ( $ value ) === '' ? null : $ value ; } if ( ! $ this -> hasSetMutator ( $ key ) ) { $ value = $ this -> getAttribute ( $ key ) ; } if ( $ this -> isJsonCastable ( $ key ) && ! is_null ( $ value ) ) { $ value = is_string ( $ value ) ? $ this -> getJsonCastValue ( $ value ) : $ value ; } return $ value ; }
For the given key and value pair, determine the actual value,
depending on whether or not a mutator or cast is in use.

@param  string  $key
@param  mixed  $value

@return mixed
For the given key and value pair determine the actual value depending on whether or not a mutator or cast is in use .