private function getModelValueAttribute($name, $model = null)
    {
        $model = $model ?: $this->getModel();

        $key = self::transformKey($name);

        if (strpos($key, '.') !== false) {
            $keys = explode('.', $key, 2);

            return $this->getModelValueAttribute(
                $keys[1],
                $this->getModelValueAttribute($keys[0], $model)
            );
        }

        return method_exists($model, 'getFormValue')
            ? $model->getFormValue($key)
            : data_get($model, $key);
    }
private function getModelValueAttribute($name, $model = null)
    {
        $model = $model ?: $this->getModel();

        $key = self::transformKey($name);

        if (strpos($key, '.') !== false) {
            $keys = explode('.', $key, 2);

            return $this->getModelValueAttribute(
                $keys[1],
                $this->getModelValueAttribute($keys[0], $model)
            );
        }

        return method_exists($model, 'getFormValue')
            ? $model->getFormValue($key)
            : data_get($model, $key);
    }
private function getModelValueAttribute ( $ name , $ model = null ) { $ model = $ model ? : $ this -> getModel ( ) ; $ key = self :: transformKey ( $ name ) ; if ( strpos ( $ key , '.' ) !== false ) { $ keys = explode ( '.' , $ key , 2 ) ; return $ this -> getModelValueAttribute ( $ keys [ 1 ] , $ this -> getModelValueAttribute ( $ keys [ 0 ] , $ model ) ) ; } return method_exists ( $ model , 'getFormValue' ) ? $ model -> getFormValue ( $ key ) : data_get ( $ model , $ key ) ; }
Get the model value that should be assigned to the field.

@param  string                               $name
@param  \Illuminate\Database\Eloquent\Model  $model

@return mixed
Get the model value that should be assigned to the field .