Closed zillarelli closed 11 years ago
Whenever I run an Eloquent query that includes a subquery, the total count ends up being null and outputs as NaN. However, changing the following seems to solve the issue for me:
in the count method: $this->count_all = $this->query->count();
$this->count_all = $this->query->count();
changed to: $this->count_all = get_class($this->query) == 'Illuminate\Database\Query\Builder' ? $this->query->count() : $this->query->get()->count();
$this->count_all = get_class($this->query) == 'Illuminate\Database\Query\Builder' ? $this->query->count() : $this->query->get()->count();
However I'm not sure if this would be the best way but perhaps someone could look into it. Thanks.
I think this issue is related to this: https://github.com/bllim/laravel4-datatables-package/pull/16
this issue is possibly fixed, as the count method has been rewritten
So it seems! Thank you
Whenever I run an Eloquent query that includes a subquery, the total count ends up being null and outputs as NaN. However, changing the following seems to solve the issue for me:
in the count method:
$this->count_all = $this->query->count();
changed to:
$this->count_all = get_class($this->query) == 'Illuminate\Database\Query\Builder' ? $this->query->count() : $this->query->get()->count();
However I'm not sure if this would be the best way but perhaps someone could look into it. Thanks.