Skip to content

Commit

Permalink
Merge pull request #5320 from Laravel-Backpack/add-model-table-prefix
Browse files Browse the repository at this point in the history
add model table prefix in query count
  • Loading branch information
pxpm authored Sep 19, 2023
2 parents 58160d0 + 954edb2 commit 4ae6a7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/Library/CrudPanel/Traits/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ private function getCountFromQuery(Builder $query)
$subQuery = $crudQuery->cloneWithout(['columns', 'orders', 'limit', 'offset']);

// select minimum possible columns for the count
$minimumColumns = ($crudQuery->groups || $crudQuery->havings) ? '*' : $modelTable.'.'.$this->model->getKeyName();
$minimumColumns = ($crudQuery->groups || $crudQuery->havings) ? $modelTable.'.*' : $modelTable.'.'.$this->model->getKeyName();
$subQuery->select($minimumColumns);

// in case there are raw expressions we need to add them too.
Expand Down

0 comments on commit 4ae6a7d

Please sign in to comment.