Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel getCountForPagination() returning Object instead of int

I am trying to get the number of results with

$total = $this->query->getCountForPagination();

And instead of receiving an (int) like I see on the documentation, a object(Illuminate\Database\Eloquent\Builder) is returned

The function is called from Query/Builder.php class which returns an int .. but I think it gets converted somehow along the way.

Any reason for that ?

like image 934
Scobee Avatar asked Feb 05 '18 13:02

Scobee


1 Answers

Use: $total = $this->query->getQuery()->getCountForPagination();

like image 87
vpalade Avatar answered Sep 21 '22 01:09

vpalade