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
…887)

Co-authored-by: Friso Modderman <friso@cell-0.com>
  • Loading branch information
adminfriso and Friso Modderman authored Nov 26, 2024
1 parent 13cb646 commit a17af14
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 a17af14

Please sign in to comment.