protected function prepareRecord($record)
    {
        if ($record[static::REMOVE_FLAG_NAME] == 1) {
            return $record;
        }

        $prepared = [];

        /* @var Field $field */
        foreach ($this->fields as $field) {
            $columns = $field->column();

            $value = $this->fetchColumnValue($record, $columns);

            if (is_null($value)) {
                continue;
            }

            if (method_exists($field, 'prepare')) {
                $value = $field->prepare($value);
            }

            if (($field instanceof \Encore\Admin\Form\Field\Hidden) || $value != $field->original()) {
                if (is_array($columns)) {
                    foreach ($columns as $name => $column) {
                        Arr::set($prepared, $column, $value[$name]);
                    }
                } elseif (is_string($columns)) {
                    Arr::set($prepared, $columns, $value);
                }
            }
        }

        $prepared[static::REMOVE_FLAG_NAME] = $record[static::REMOVE_FLAG_NAME];

        return $prepared;
    }
protected function prepareRecord($record)
    {
        if ($record[static::REMOVE_FLAG_NAME] == 1) {
            return $record;
        }

        $prepared = [];

        /* @var Field $field */
        foreach ($this->fields as $field) {
            $columns = $field->column();

            $value = $this->fetchColumnValue($record, $columns);

            if (is_null($value)) {
                continue;
            }

            if (method_exists($field, 'prepare')) {
                $value = $field->prepare($value);
            }

            if (($field instanceof \Encore\Admin\Form\Field\Hidden) || $value != $field->original()) {
                if (is_array($columns)) {
                    foreach ($columns as $name => $column) {
                        Arr::set($prepared, $column, $value[$name]);
                    }
                } elseif (is_string($columns)) {
                    Arr::set($prepared, $columns, $value);
                }
            }
        }

        $prepared[static::REMOVE_FLAG_NAME] = $record[static::REMOVE_FLAG_NAME];

        return $prepared;
    }
protected function prepareRecord ( $ record ) { if ( $ record [ static :: REMOVE_FLAG_NAME ] == 1 ) { return $ record ; } $ prepared = [ ] ; /* @var Field $field */ foreach ( $ this -> fields as $ field ) { $ columns = $ field -> column ( ) ; $ value = $ this -> fetchColumnValue ( $ record , $ columns ) ; if ( is_null ( $ value ) ) { continue ; } if ( method_exists ( $ field , 'prepare' ) ) { $ value = $ field -> prepare ( $ value ) ; } if ( ( $ field instanceof \ Encore \ Admin \ Form \ Field \ Hidden ) || $ value != $ field -> original ( ) ) { if ( is_array ( $ columns ) ) { foreach ( $ columns as $ name => $ column ) { Arr :: set ( $ prepared , $ column , $ value [ $ name ] ) ; } } elseif ( is_string ( $ columns ) ) { Arr :: set ( $ prepared , $ columns , $ value ) ; } } } $ prepared [ static :: REMOVE_FLAG_NAME ] = $ record [ static :: REMOVE_FLAG_NAME ] ; return $ prepared ; }
Do prepare work before store and update.

@param array $record

@return array
Do prepare work before store and update .