src/Versioned.php
public function doArchive()
    {
        $owner = $this->owner;
        $owner->invokeWithExtensions('onBeforeArchive', $this);
        $owner->deleteFromChangeSets();
        // Unpublish without creating deleted version
        $this->suppressDeletedVersion(function () use ($owner) {
            $owner->doUnpublish();
            $owner->deleteFromStage(static::DRAFT);
        });
        // Create deleted version in both stages
        $this->createDeletedVersion([
            static::LIVE,
            static::DRAFT,
        ]);
        $owner->invokeWithExtensions('onAfterArchive', $this);
        return true;
    }
public function doArchive()
    {
        $owner = $this->owner;
        $owner->invokeWithExtensions('onBeforeArchive', $this);
        $owner->deleteFromChangeSets();
        // Unpublish without creating deleted version
        $this->suppressDeletedVersion(function () use ($owner) {
            $owner->doUnpublish();
            $owner->deleteFromStage(static::DRAFT);
        });
        // Create deleted version in both stages
        $this->createDeletedVersion([
            static::LIVE,
            static::DRAFT,
        ]);
        $owner->invokeWithExtensions('onAfterArchive', $this);
        return true;
    }
public function doArchive ( ) { $ owner = $ this -> owner ; $ owner -> invokeWithExtensions ( 'onBeforeArchive' , $ this ) ; $ owner -> deleteFromChangeSets ( ) ; // Unpublish without creating deleted version $ this -> suppressDeletedVersion ( function ( ) use ( $ owner ) { $ owner -> doUnpublish ( ) ; $ owner -> deleteFromStage ( static :: DRAFT ) ; } ) ; // Create deleted version in both stages $ this -> createDeletedVersion ( [ static :: LIVE , static :: DRAFT , ] ) ; $ owner -> invokeWithExtensions ( 'onAfterArchive' , $ this ) ; return true ; }
Removes the record from both live and stage

User code should call {@see canArchive()} prior to invoking this method.

@return bool Success
Removes the record from both live and stage