app/Document.php
/**
     * delete document. if document object is passed, delete those documents
     *
     * @param $document
     * @return array|$this
     */
delete document. if document object is passed, delete those documents
@param $document
@return array|$this
delete document . if document object is passed delete those documents @param $document @return array|$this
public static function deleteDocument($document)
    {
        $self = new self();
        $path = $document->pluck('path');
        $deletedDocuments = [];
        foreach ($path as $p) {
            if (!$deleted = $self->_deleteDocument($p)) {
                return $deleted;
            }
            $deletedDocuments[] = $deleted;
        }
        return $deletedDocuments;
    }
public static function deleteDocument ( $ document ) { $ self = new self ( ) ; $ path = $ document -> pluck ( 'path' ) ; $ deletedDocuments = [ ] ; foreach ( $ path as $ p ) { if ( ! $ deleted = $ self -> _deleteDocument ( $ p ) ) { return $ deleted ; } $ deletedDocuments [ ] = $ deleted ; } return $ deletedDocuments ; }
delete document.
delete document .
//array of deleted document objects