protected function buildDocumentFromArray(array $searchable)
    {
        $document = [];

        foreach ($searchable as $value) {
            $result = $this->$value;

            if ($result instanceof Collection) {
                $result = $result->toArray();
            } elseif ($result instanceof Carbon) {
                $result = $result->toDateTimeString();
            } else {
                $result = $this->$value;
            }

            $document[$value] = $result;
        }

        return $document;
    }
protected function buildDocumentFromArray(array $searchable)
    {
        $document = [];

        foreach ($searchable as $value) {
            $result = $this->$value;

            if ($result instanceof Collection) {
                $result = $result->toArray();
            } elseif ($result instanceof Carbon) {
                $result = $result->toDateTimeString();
            } else {
                $result = $this->$value;
            }

            $document[$value] = $result;
        }

        return $document;
    }
protected function buildDocumentFromArray ( array $ searchable ) { $ document = [ ] ; foreach ( $ searchable as $ value ) { $ result = $ this -> $ value ; if ( $ result instanceof Collection ) { $ result = $ result -> toArray ( ) ; } elseif ( $ result instanceof Carbon ) { $ result = $ result -> toDateTimeString ( ) ; } else { $ result = $ this -> $ value ; } $ document [ $ value ] = $ result ; } return $ document ; }
Build the document from a searchable array.

@param array $searchable

@return array
Build the document from a searchable array .