我有个棘手的案子...
Following database query does not work:
DB::table('posts')
->select('posts.*', DB::raw($haversineSQL . ' as distance'))
->having('distance', '<=', $distance)
->paginate(10);
It fails with message: column distance does not exist.
当paginate()try 使用
select count(*) as aggregate from {query without the column names}
由于列名被剥离,距离未知,因此会引发异常.
Does somebody have a work around to be able to use pagination is this case ?
谢谢