I have a tricky case ...
Following database query does not work:
DB::table(\'posts\') ->select(\'posts.*\', DB::raw($haversineSQL . \' as distance
Using Eloquent, I know you can pass columns to the paginator, something like this:
Post::having('distance','<=', $distance) ->paginate(10, array('*', DB::raw($haversineSQL . ' as distance')));
Not sure if it works without Eloquent, but you could give it a try.