public function deleteSubtree($withSelf = false, $forceDelete = false)
    {
        $action = ($forceDelete === true ? 'forceDelete' : 'delete');

        $ids = $this->joinClosureBy('descendant', $withSelf)->pluck($this->getKeyName());

        if ($forceDelete) {
            $this->closure->whereIn($this->closure->getDescendantColumn(), $ids)->delete();
        }

        $this->whereIn($this->getKeyName(), $ids)->$action();
    }
public function deleteSubtree($withSelf = false, $forceDelete = false)
    {
        $action = ($forceDelete === true ? 'forceDelete' : 'delete');

        $ids = $this->joinClosureBy('descendant', $withSelf)->pluck($this->getKeyName());

        if ($forceDelete) {
            $this->closure->whereIn($this->closure->getDescendantColumn(), $ids)->delete();
        }

        $this->whereIn($this->getKeyName(), $ids)->$action();
    }
public function deleteSubtree ( $ withSelf = false , $ forceDelete = false ) { $ action = ( $ forceDelete === true ? 'forceDelete' : 'delete' ) ; $ ids = $ this -> joinClosureBy ( 'descendant' , $ withSelf ) -> pluck ( $ this -> getKeyName ( ) ) ; if ( $ forceDelete ) { $ this -> closure -> whereIn ( $ this -> closure -> getDescendantColumn ( ) , $ ids ) -> delete ( ) ; } $ this -> whereIn ( $ this -> getKeyName ( ) , $ ids ) -> $ action ( ) ; }
Deletes a subtree from database.

@param bool $withSelf
@param bool $forceDelete

@return void
Deletes a subtree from database .