public function getDataModel()
    {
        $dataModel = array();
        $model     = $this->config->getDataModel();

        foreach ($this->getEditFieldsArrays() as $name => $options) {
            //if this is a key, set it to 0
            if ($options['type'] === 'key') {
                $dataModel[$name] = 0;
            } else {
                //if this is a collection, convert it to an array
                if (is_a($model->$name, 'Illuminate\Database\Eloquent\Collection')) {
                    $dataModel[$name] = $model->$name->toArray();
                } else {
                    $dataModel[$name] = isset($options['value']) ? $options['value'] : null;
                }
            }
        }

        return $dataModel;
    }
public function getDataModel()
    {
        $dataModel = array();
        $model     = $this->config->getDataModel();

        foreach ($this->getEditFieldsArrays() as $name => $options) {
            //if this is a key, set it to 0
            if ($options['type'] === 'key') {
                $dataModel[$name] = 0;
            } else {
                //if this is a collection, convert it to an array
                if (is_a($model->$name, 'Illuminate\Database\Eloquent\Collection')) {
                    $dataModel[$name] = $model->$name->toArray();
                } else {
                    $dataModel[$name] = isset($options['value']) ? $options['value'] : null;
                }
            }
        }

        return $dataModel;
    }
public function getDataModel ( ) { $ dataModel = array ( ) ; $ model = $ this -> config -> getDataModel ( ) ; foreach ( $ this -> getEditFieldsArrays ( ) as $ name => $ options ) { //if this is a key, set it to 0 if ( $ options [ 'type' ] === 'key' ) { $ dataModel [ $ name ] = 0 ; } else { //if this is a collection, convert it to an array if ( is_a ( $ model -> $ name , 'Illuminate\Database\Eloquent\Collection' ) ) { $ dataModel [ $ name ] = $ model -> $ name -> toArray ( ) ; } else { $ dataModel [ $ name ] = isset ( $ options [ 'value' ] ) ? $ options [ 'value' ] : null ; } } } return $ dataModel ; }
Gets the data model given the edit fields.

@return array
Gets the data model given the edit fields .