|
@@ -149,8 +149,7 @@ discard block |
|
|
block discarded – undo |
|
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,7 +165,7 @@ discard block |
|
|
block discarded – undo |
|
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
|
170
|
})->orderBy($instance->getKeyName())->chunk(config('scout.chunk.searchable', 500), function($models) { |
|
172
|
171
|
$models->filter->shouldBeSearchable()->map(function($model) { |
|
@@ -186,7 +185,7 @@ discard block |
|
|
block discarded – undo |
|
186
|
185
|
foreach ((new static)->getModels() as $model) { |
|
187
|
186
|
$instance = new $model; |
|
188
|
187
|
|
|
189
|
|
- $instance->newQuery()->orderBy($instance->getKeyName())->get()->map(function ($model) { |
|
|
188
|
+ $instance->newQuery()->orderBy($instance->getKeyName())->get()->map(function($model) { |
|
190
|
189
|
return static::create($model); |
|
191
|
190
|
})->unsearchable(); |
|
192
|
191
|
|
|
@@ -209,7 +208,7 @@ discard block |
|
|
block discarded – undo |
|
209
|
208
|
$softDeletes = |
|
210
|
209
|
in_array(SoftDeletes::class, class_uses_recursive($model), true) && config('scout.soft_delete', false); |
|
211
|
210
|
|
|
212
|
|
- $count += $model::query()->when($softDeletes, function ($query) { |
|
|
211
|
+ $count += $model::query()->when($softDeletes, function($query) { |
|
213
|
212
|
$query->withTrashed(); |
|
214
|
213
|
})->count(); |
|
215
|
214
|
} |