You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using dev-master version of laravel-scout-postgres.
Both withTrashed and onlyTrashed method are not properly handled.
Scout Builder has __soft_deleted in wheres attribute when its config soft_delete set to true. This will throw an Exception because no such column in the table.
Current PostgresEngine only set $query->whereNull($builder->model->getDeletedAtColumn()); if the model use SoftDeletes.
I modify the engine to deal with this problem.
// Handle soft deletesif (!$this->isExternalIndex($builder->model)) {
if ($this->usesSoftDeletes($builder->model) && isset($builder->wheres['__soft_deleted'])) {
if ($builder->wheres['__soft_deleted']) {
$query->whereNotNull($builder->model->getDeletedAtColumn());
} else {
$query->whereNull($builder->model->getDeletedAtColumn());
}
unset($builder->wheres['__soft_deleted']);
}
}
// Apply where clauses that were set on the builder instance if anyforeach ($builder->wheresas$key => $value) {
$query->where($key, $value);
$bindings->push($value);
}
/* Deleted // If parsed documents are being stored in the model's table if (! $this->isExternalIndex($builder->model)) { // and the model uses soft deletes we need to exclude trashed rows if ($this->usesSoftDeletes($builder->model)) { $query->whereNull($builder->model->getDeletedAtColumn()); } } */
The text was updated successfully, but these errors were encountered:
I'm using
dev-master
version oflaravel-scout-postgres
.Both
withTrashed
andonlyTrashed
method are not properly handled.Scout Builder has
__soft_deleted
inwheres
attribute when its configsoft_delete
set totrue
. This will throw an Exception because no such column in the table.Current
PostgresEngine
only set$query->whereNull($builder->model->getDeletedAtColumn());
if the model useSoftDeletes
.I modify the engine to deal with this problem.
The text was updated successfully, but these errors were encountered: