public function afterFetch()
    {
        $data = (array) $this->data + $this->getDefaultValues();

        /*
         * Repeater form fields store arrays and must be jsonable.
         */
        foreach ($this->getFormFields() as $id => $field) {
            if (!isset($field['type'])) {
                continue;
            }

            if ($field['type'] === 'repeater') {
                $this->jsonable[] = $id;
            }
            elseif ($field['type'] === 'fileupload') {
                $this->attachOne[$id] = File::class;
                unset($data[$id]);
            }
        }

        /*
         * Fill this model with the jsonable attributes kept in 'data'.
         */
        $this->setRawAttributes((array) $this->getAttributes() + $data, true);
    }
public function afterFetch()
    {
        $data = (array) $this->data + $this->getDefaultValues();

        /*
         * Repeater form fields store arrays and must be jsonable.
         */
        foreach ($this->getFormFields() as $id => $field) {
            if (!isset($field['type'])) {
                continue;
            }

            if ($field['type'] === 'repeater') {
                $this->jsonable[] = $id;
            }
            elseif ($field['type'] === 'fileupload') {
                $this->attachOne[$id] = File::class;
                unset($data[$id]);
            }
        }

        /*
         * Fill this model with the jsonable attributes kept in 'data'.
         */
        $this->setRawAttributes((array) $this->getAttributes() + $data, true);
    }
public function afterFetch ( ) { $ data = ( array ) $ this -> data + $ this -> getDefaultValues ( ) ; /*
         * Repeater form fields store arrays and must be jsonable.
         */ foreach ( $ this -> getFormFields ( ) as $ id => $ field ) { if ( ! isset ( $ field [ 'type' ] ) ) { continue ; } if ( $ field [ 'type' ] === 'repeater' ) { $ this -> jsonable [ ] = $ id ; } elseif ( $ field [ 'type' ] === 'fileupload' ) { $ this -> attachOne [ $ id ] = File :: class ; unset ( $ data [ $ id ] ) ; } } /*
         * Fill this model with the jsonable attributes kept in 'data'.
         */ $ this -> setRawAttributes ( ( array ) $ this -> getAttributes ( ) + $ data , true ) ; }
After fetching the model, intiialize model relationships based
on form field definitions.
@return void
After fetching the model intiialize model relationships based on form field definitions .