Skip to content

Commit

Permalink
Fix: ambigious queries when adding other tables to the query builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Friso Modderman committed Nov 26, 2024
1 parent 13cb646 commit 0aa49c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Engines/DatabaseEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function paginateUsingDatabase(Builder $builder, $perPage, $pageName, $pa
}
})
->when(! $this->getFullTextColumns($builder), function ($query) use ($builder) {
$query->orderBy($builder->model->getScoutKeyName(), 'desc');
$query->orderBy($builder->model->getTable().'.'.$builder->model->getScoutKeyName(), 'desc');
})
->paginate($perPage, ['*'], $pageName, $page);
}
Expand Down Expand Up @@ -127,7 +127,7 @@ public function simplePaginateUsingDatabase(Builder $builder, $perPage, $pageNam
}
})
->when(! $this->getFullTextColumns($builder), function ($query) use ($builder) {
$query->orderBy($builder->model->getScoutKeyName(), 'desc');
$query->orderBy($builder->model->getTable().'.'.$builder->model->getScoutKeyName(), 'desc');
})
->simplePaginate($perPage, ['*'], $pageName, $page);
}
Expand All @@ -152,7 +152,7 @@ protected function searchModels(Builder $builder, $page = null, $perPage = null)
}
})
->when(! $this->getFullTextColumns($builder), function ($query) use ($builder) {
$query->orderBy($builder->model->getScoutKeyName(), 'desc');
$query->orderBy($builder->model->getTable().'.'.$builder->model->getScoutKeyName(), 'desc');
})
->get();
}
Expand Down

0 comments on commit 0aa49c5

Please sign in to comment.