public function deleteRevision($clear = true)
    {
        $this->getFieldTypes()->each(function ($type) {
            $type::where('revision_id', $this->revision->id)->delete();
        });

        // If this revision is currently
        // published, we need to publish
        // another revision in place.
        if ($this->revision->published && $this->revision->exists) {
            //TODO :: improve this logic
            Revision::where('content_id', $this->content->id)
                ->where('id', '!=', $this->revision->id)
                ->take(1)
                ->update(['published' => true]);
        }

        $this->revision->delete();

        if ($clear) {
            $this->clearFields();
        }
    }
public function deleteRevision($clear = true)
    {
        $this->getFieldTypes()->each(function ($type) {
            $type::where('revision_id', $this->revision->id)->delete();
        });

        // If this revision is currently
        // published, we need to publish
        // another revision in place.
        if ($this->revision->published && $this->revision->exists) {
            //TODO :: improve this logic
            Revision::where('content_id', $this->content->id)
                ->where('id', '!=', $this->revision->id)
                ->take(1)
                ->update(['published' => true]);
        }

        $this->revision->delete();

        if ($clear) {
            $this->clearFields();
        }
    }
public function deleteRevision ( $ clear = true ) { $ this -> getFieldTypes ( ) -> each ( function ( $ type ) { $ type :: where ( 'revision_id' , $ this -> revision -> id ) -> delete ( ) ; } ) ; // If this revision is currently // published, we need to publish // another revision in place. if ( $ this -> revision -> published && $ this -> revision -> exists ) { //TODO :: improve this logic Revision :: where ( 'content_id' , $ this -> content -> id ) -> where ( 'id' , '!=' , $ this -> revision -> id ) -> take ( 1 ) -> update ( [ 'published' => true ] ) ; } $ this -> revision -> delete ( ) ; if ( $ clear ) { $ this -> clearFields ( ) ; } }
Delete the current revision.

@param bool $clear Should we clear the fields after deleting the revision ?
Delete the current revision .