public function delete($clear = true)
    {
        $revisions = Revision::where('content_id', $this->content->id)->get();

        $ids = $revisions->pluck('id');

        $this->getFieldTypes()->each(function ($type) use ($ids) {
            $type::whereIn('revision_id', $ids)->delete();
        });

        Revision::whereIn('id', $ids)->delete();
        $this->revision->exists = false;

        // TODO :: add an event system to be able to remove this content from entity fields

        $this->content->delete();

        if ($clear) {
            $this->revision->id = null;
            $this->content->id = null;
            $this->clearFields();
        }
    }
public function delete($clear = true)
    {
        $revisions = Revision::where('content_id', $this->content->id)->get();

        $ids = $revisions->pluck('id');

        $this->getFieldTypes()->each(function ($type) use ($ids) {
            $type::whereIn('revision_id', $ids)->delete();
        });

        Revision::whereIn('id', $ids)->delete();
        $this->revision->exists = false;

        // TODO :: add an event system to be able to remove this content from entity fields

        $this->content->delete();

        if ($clear) {
            $this->revision->id = null;
            $this->content->id = null;
            $this->clearFields();
        }
    }
public function delete ( $ clear = true ) { $ revisions = Revision :: where ( 'content_id' , $ this -> content -> id ) -> get ( ) ; $ ids = $ revisions -> pluck ( 'id' ) ; $ this -> getFieldTypes ( ) -> each ( function ( $ type ) use ( $ ids ) { $ type :: whereIn ( 'revision_id' , $ ids ) -> delete ( ) ; } ) ; Revision :: whereIn ( 'id' , $ ids ) -> delete ( ) ; $ this -> revision -> exists = false ; // TODO :: add an event system to be able to remove this content from entity fields $ this -> content -> delete ( ) ; if ( $ clear ) { $ this -> revision -> id = null ; $ this -> content -> id = null ; $ this -> clearFields ( ) ; } }
Delete this entity and all the underlying Revisions.

@param bool $clear Should we clear the fields after deleting the revision ?
Delete this entity and all the underlying Revisions .