/** * @param \Illuminate\Database\Eloquent\Model $model */ public function indexer(Model $model) { // Check model if has instance of ElasticIndexer if (!$model instanceof ElasticIndexer) { return; } // Boot model for index $model->indexModel(); $this->indexer = new Index($model); $this->indexer->save(); }