diff --git a/src/DesignMyNight/Elasticsearch/Collection.php b/src/DesignMyNight/Elasticsearch/Collection.php new file mode 100644 index 0000000..8cb314f --- /dev/null +++ b/src/DesignMyNight/Elasticsearch/Collection.php @@ -0,0 +1,27 @@ +isEmpty() ){ + return; + } + + $instance = $this->first(); + + $docs = $this->map(function($model){ + return $model->toSearchableArray(); + }); + + return $instance->onSearchConnection(function($docs, $instance){ + $query = $instance->newQueryWithoutScopes(); + + return $query->insert($docs->all()); + }, $docs, $instance); + } +} \ No newline at end of file