I have a problem with how eloquent the wording of the request is, to which I do not have access. When you do something like
$model->where('something')
->distinct()
->paginate();
eloquent runs the query to get the total, and the query looks something like this:
select count(*) as aggregate from .....
The problem is that if you use a different query, you want something like
select count(distinct id) as aggregate from .....
to get the right amount. The eloquent does not do this, although, thus, returning the wrong results. The only way to get the report in the invoice is to pass the argument through the query builder, for example: → count ('id'), in which case it will add it. The problem is that this request is auto-generated, and I do not control it.
Is there a way to trick it into adding a separate count to the request?
P.S. , IF, count(), . \Database\Query\\BaseGrammar @compileAggregate
if ($query->distinct && $column !== '*')
{
$column = 'distinct '.$column;
}
return 'select '.$aggregate['function'].'('.$column.') as aggregate';
PS1 , SQL , , , IN ( ) , .