public function getDbValues(array $input = [], $mappings = [])
    {
       $response = [];
       foreach ($mappings as $inputKey => $dbValue) {
            if (is_array($input) && array_get($input, $inputKey) !== null) {
                $value = array_get($input, $inputKey);
                if ($value instanceof UploadedFile) {
                    array_set($response, $dbValue, $value);
                } elseif (is_array($value)) {
                    if (class_exists($mappings[$inputKey]['class'])) {
                        $class = new $mappings[$inputKey]['class']($this->app);
                        foreach ($value as $v) {
                            $response[$mappings[$inputKey]['key']][] = $this->getDbValues($v, $class->mappings());
                        }
                    } else {
                        array_set($response, $dbValue, $value);
                    }
                } else {
                    array_set($response, $dbValue, (is_bool($value) ? $value : trim($value)));
                }
            }
        }
        
        return $response;
    }
public function getDbValues(array $input = [], $mappings = [])
    {
       $response = [];
       foreach ($mappings as $inputKey => $dbValue) {
            if (is_array($input) && array_get($input, $inputKey) !== null) {
                $value = array_get($input, $inputKey);
                if ($value instanceof UploadedFile) {
                    array_set($response, $dbValue, $value);
                } elseif (is_array($value)) {
                    if (class_exists($mappings[$inputKey]['class'])) {
                        $class = new $mappings[$inputKey]['class']($this->app);
                        foreach ($value as $v) {
                            $response[$mappings[$inputKey]['key']][] = $this->getDbValues($v, $class->mappings());
                        }
                    } else {
                        array_set($response, $dbValue, $value);
                    }
                } else {
                    array_set($response, $dbValue, (is_bool($value) ? $value : trim($value)));
                }
            }
        }
        
        return $response;
    }
public function getDbValues ( array $ input = [ ] , $ mappings = [ ] ) { $ response = [ ] ; foreach ( $ mappings as $ inputKey => $ dbValue ) { if ( is_array ( $ input ) && array_get ( $ input , $ inputKey ) !== null ) { $ value = array_get ( $ input , $ inputKey ) ; if ( $ value instanceof UploadedFile ) { array_set ( $ response , $ dbValue , $ value ) ; } elseif ( is_array ( $ value ) ) { if ( class_exists ( $ mappings [ $ inputKey ] [ 'class' ] ) ) { $ class = new $ mappings [ $ inputKey ] [ 'class' ] ( $ this -> app ) ; foreach ( $ value as $ v ) { $ response [ $ mappings [ $ inputKey ] [ 'key' ] ] [ ] = $ this -> getDbValues ( $ v , $ class -> mappings ( ) ) ; } } else { array_set ( $ response , $ dbValue , $ value ) ; } } else { array_set ( $ response , $ dbValue , ( is_bool ( $ value ) ? $ value : trim ( $ value ) ) ) ; } } } return $ response ; }
conver given array keys to mapper keys
@param  array $inputs
@return array
conver given array keys to mapper keys