2016-11-23 6 views

ответ

4

Вы можете использовать getAlgoliaRecord() method в своей модели и вернуть массив из него с атрибутами, которые вы хотите индексировать.

Пример:

use Illuminate\Database\Eloquent\Model; 

class Contact extends Model 
{ 
    use AlgoliaEloquentTrait; 

    public function getAlgoliaRecord() 
    { 
     return [ 
      'indexedAttribute' => $this->indexedAttribute, 
      'otherIindexedAttribute' => $this->otherIindexedAttribute, 
      'nextIndexedAttribute' => $this->nextIndexedAttribute, 
     ]; 
    } 
}