laravel - Update index algolia -


i have index in algolia using documents , users associated theses documents

class documents extends model { use searchable;  public function tosearchablearray() {   $data = $this->toarray();    // formatting relationship algolia    $data['users'] = $this->types->toarray();   $data['document_type'] = $this->typedocuments->name;   return $data; }  protected $fillable = array('name', 'description', 'document_type');  public function types() {     return $this->belongstomany('app\users', 'document_rights', 'user_id', 'id'); }  public function typedocuments() {     return $this->belongsto('app\document_type', 'document_type'); } } 

in case, update 1 day, name of users, :

  public function update(request $request)   {       $user = users::find(5);       $user->name = 'jean floriot';       $user->update();   } 

but never changes user in index of algolia. ideas how proceed ?

i'm using laravel 5.5 scout

i believe can use searchable() method that. after $this->update() like:

app\documents::where('user_id', '=', $this->id)->searchable(); 

please let me know if worked or if missed something.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -