protected function versionablePostSave()
    {
        /**
         * We'll save new versions on updating and first creation
         */
        if (
            ( $this->versioningEnabled === true && $this->updating && $this->isValidForVersioning() ) ||
            ( $this->versioningEnabled === true && !$this->updating && !is_null($this->versionableDirtyData) && count($this->versionableDirtyData))
        ) {
            // Save a new version
            $class                     = $this->getVersionClass();
            $version                   = new $class();
            $version->versionable_id   = $this->getKey();
            $version->versionable_type = get_class($this);
            $version->user_id          = $this->getAuthUserId();
            $version->model_data       = serialize($this->getAttributes());

            if (!empty( $this->reason )) {
                $version->reason = $this->reason;
            }

            $version->save();

            $this->purgeOldVersions();
        }
    }
protected function versionablePostSave()
    {
        /**
         * We'll save new versions on updating and first creation
         */
        if (
            ( $this->versioningEnabled === true && $this->updating && $this->isValidForVersioning() ) ||
            ( $this->versioningEnabled === true && !$this->updating && !is_null($this->versionableDirtyData) && count($this->versionableDirtyData))
        ) {
            // Save a new version
            $class                     = $this->getVersionClass();
            $version                   = new $class();
            $version->versionable_id   = $this->getKey();
            $version->versionable_type = get_class($this);
            $version->user_id          = $this->getAuthUserId();
            $version->model_data       = serialize($this->getAttributes());

            if (!empty( $this->reason )) {
                $version->reason = $this->reason;
            }

            $version->save();

            $this->purgeOldVersions();
        }
    }
protected function versionablePostSave ( ) { /**
         * We'll save new versions on updating and first creation
         */ if ( ( $ this -> versioningEnabled === true && $ this -> updating && $ this -> isValidForVersioning ( ) ) || ( $ this -> versioningEnabled === true && ! $ this -> updating && ! is_null ( $ this -> versionableDirtyData ) && count ( $ this -> versionableDirtyData ) ) ) { // Save a new version $ class = $ this -> getVersionClass ( ) ; $ version = new $ class ( ) ; $ version -> versionable_id = $ this -> getKey ( ) ; $ version -> versionable_type = get_class ( $ this ) ; $ version -> user_id = $ this -> getAuthUserId ( ) ; $ version -> model_data = serialize ( $ this -> getAttributes ( ) ) ; if ( ! empty ( $ this -> reason ) ) { $ version -> reason = $ this -> reason ; } $ version -> save ( ) ; $ this -> purgeOldVersions ( ) ; } }
Save a new version.
@return void
Save a new version .