public function getDocumentData()
    {
        // If the model contain a buildDocument function
        // use it to build the document
        if (method_exists($this, 'buildDocument')) {
            $document = $this->buildDocument();

            return $document;
        }
        // If a searchable array is provided build
        // the document from the given array
        elseif (is_array($this->searchable)) {
            $document = $this->buildDocumentFromArray($this->searchable);

            return $document;
        } else {
            $document = $this->toArray();

            return $document;
        }
    }
public function getDocumentData()
    {
        // If the model contain a buildDocument function
        // use it to build the document
        if (method_exists($this, 'buildDocument')) {
            $document = $this->buildDocument();

            return $document;
        }
        // If a searchable array is provided build
        // the document from the given array
        elseif (is_array($this->searchable)) {
            $document = $this->buildDocumentFromArray($this->searchable);

            return $document;
        } else {
            $document = $this->toArray();

            return $document;
        }
    }
public function getDocumentData ( ) { // If the model contain a buildDocument function // use it to build the document if ( method_exists ( $ this , 'buildDocument' ) ) { $ document = $ this -> buildDocument ( ) ; return $ document ; } // If a searchable array is provided build // the document from the given array elseif ( is_array ( $ this -> searchable ) ) { $ document = $ this -> buildDocumentFromArray ( $ this -> searchable ) ; return $ document ; } else { $ document = $ this -> toArray ( ) ; return $ document ; } }
Build the document data with the appropriate method.

@return array
Build the document data with the appropriate method .