Laravel-Geographical icon indicating copy to clipboard operation
Laravel-Geographical copied to clipboard

Geofence does not work with pagination

Open Ruitjes opened this issue 5 years ago • 2 comments

Laravel Framework 5.8.14 PHP 7.2.11 10.2.10-MariaDB

 $ads = Ads::geofence($json->lat, $json->lon, 0, $distance);
 $ads = $ads->Paginate(25);

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'distance' in 'having clause' (SQL: select count(*) as aggregate from ads having distance BETWEEN 0 AND 99999999)

Ruitjes avatar Jul 19 '19 11:07 Ruitjes

It will work with simplePagination. But its not ideal in my case..

Ruitjes avatar Jul 24 '19 09:07 Ruitjes

Just to let others know there is a package which allows you to paginate with the "having" clause.

https://github.com/justbetter/laravel-pagination-with-havings

mattiusclay avatar Sep 13 '19 10:09 mattiusclay