adamfairholm / Elasticquent

Map Larvel Eloquent models to Elasticsearch types
MIT License
201 stars 38 forks source link

Eager loaded data #1

Closed ognjenm closed 9 years ago

ognjenm commented 10 years ago

How to index with eager loaded data?

yswery commented 9 years ago
$things = Stuff:with('things')->get();
$things->addToIndex()

Do keep in mind that when you aply a search it will return the related data in array form (not as a model collection)

adamfairholm commented 9 years ago

Thanks, @yswery - I didn't even think of doing this - that works nicely even though you are correct it's just going to return the array and not the full model.