@@ -150,8 +150,7 @@ discard block |
||
| 150 | 150 | throw new ModelNotDefinedInAggregatorException(); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - return method_exists($this->model, 'toSearchableArray') ? $this->model->toSearchableArray() : |
|
| 154 | - $this->model->toArray(); |
|
| 153 | + return method_exists($this->model, 'toSearchableArray') ? $this->model->toSearchableArray() : $this->model->toArray(); |
|
| 155 | 154 | } |
| 156 | 155 | |
| 157 | 156 | /** |
@@ -167,10 +166,10 @@ discard block |
||
| 167 | 166 | $softDeletes = |
| 168 | 167 | in_array(SoftDeletes::class, class_uses_recursive($model)) && config('scout.soft_delete', false); |
| 169 | 168 | |
| 170 | - $instance->newQuery()->when($softDeletes, function ($query) { |
|
| 169 | + $instance->newQuery()->when($softDeletes, function($query) { |
|
| 171 | 170 | $query->withTrashed(); |
| 172 | - })->orderBy($instance->getKeyName())->chunk(config('scout.chunk.searchable', 500), function ($models) { |
|
| 173 | - $models = $models->map(function ($model) { |
|
| 171 | + })->orderBy($instance->getKeyName())->chunk(config('scout.chunk.searchable', 500), function($models) { |
|
| 172 | + $models = $models->map(function($model) { |
|
| 174 | 173 | return static::create($model); |
| 175 | 174 | })->filter->shouldBeSearchable(); |
| 176 | 175 | |
@@ -192,7 +191,7 @@ discard block |
||
| 192 | 191 | $softDeletes = |
| 193 | 192 | in_array(SoftDeletes::class, class_uses_recursive($model), true) && config('scout.soft_delete', false); |
| 194 | 193 | |
| 195 | - $count += $model::query()->when($softDeletes, function ($query) { |
|
| 194 | + $count += $model::query()->when($softDeletes, function($query) { |
|
| 196 | 195 | $query->withTrashed(); |
| 197 | 196 | })->count(); |
| 198 | 197 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | foreach ($searchableFinder->fromCommand($this) as $searchable) { |
| 42 | 42 | $this->call('scout:flush', ['searchable' => $searchable]); |
| 43 | 43 | |
| 44 | - $events->listen(ModelsImported::class, function ($event) use ($searchable) { |
|
| 44 | + $events->listen(ModelsImported::class, function($event) use ($searchable) { |
|
| 45 | 45 | $last = ObjectIdEncrypter::encrypt($event->models->last()); |
| 46 | 46 | |
| 47 | 47 | $this->line('<comment>Imported ['.$searchable.'] models up to ID:</comment> '.$last); |