@@ -149,8 +149,7 @@ discard block |
||
| 149 | 149 | throw new ModelNotDefinedInAggregatorException(); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - return method_exists($this->model, 'toSearchableArray') ? $this->model->toSearchableArray() : |
|
| 153 | - $this->model->toArray(); |
|
| 152 | + return method_exists($this->model, 'toSearchableArray') ? $this->model->toSearchableArray() : $this->model->toArray(); |
|
| 154 | 153 | } |
| 155 | 154 | |
| 156 | 155 | /** |
@@ -166,10 +165,10 @@ discard block |
||
| 166 | 165 | $softDeletes = |
| 167 | 166 | in_array(SoftDeletes::class, class_uses_recursive($model)) && config('scout.soft_delete', false); |
| 168 | 167 | |
| 169 | - $instance->newQuery()->when($softDeletes, function ($query) { |
|
| 168 | + $instance->newQuery()->when($softDeletes, function($query) { |
|
| 170 | 169 | $query->withTrashed(); |
| 171 | - })->orderBy($instance->getKeyName())->chunk(config('scout.chunk.searchable', 500), function ($models) { |
|
| 172 | - $models->filter->shouldBeSearchable()->map(function ($model) { |
|
| 170 | + })->orderBy($instance->getKeyName())->chunk(config('scout.chunk.searchable', 500), function($models) { |
|
| 171 | + $models->filter->shouldBeSearchable()->map(function($model) { |
|
| 173 | 172 | return static::create($model); |
| 174 | 173 | })->searchable(); |
| 175 | 174 | }); |
@@ -186,8 +185,8 @@ discard block |
||
| 186 | 185 | foreach ((new static)->getModels() as $model) { |
| 187 | 186 | $instance = new $model; |
| 188 | 187 | |
| 189 | - $instance->newQuery()->orderBy($instance->getKeyName())->chunk(config('scout.chunk.searchable', 500), function ($models) { |
|
| 190 | - $models->map(function ($model) { |
|
| 188 | + $instance->newQuery()->orderBy($instance->getKeyName())->chunk(config('scout.chunk.searchable', 500), function($models) { |
|
| 189 | + $models->map(function($model) { |
|
| 191 | 190 | return static::create($model); |
| 192 | 191 | })->unsearchable(); |
| 193 | 192 | }); |
@@ -205,7 +204,7 @@ discard block |
||
| 205 | 204 | $softDeletes = |
| 206 | 205 | in_array(SoftDeletes::class, class_uses_recursive($model), true) && config('scout.soft_delete', false); |
| 207 | 206 | |
| 208 | - $count += $model::query()->when($softDeletes, function ($query) { |
|
| 207 | + $count += $model::query()->when($softDeletes, function($query) { |
|
| 209 | 208 | $query->withTrashed(); |
| 210 | 209 | })->count(); |
| 211 | 210 | } |