I believe you can pass a select clause in eloquent - untested of course :):
\NearestPoint::select(array( \DB::raw('ST_Distance(geom_point, ST_SetSRID(ST_MakePoint(51.648896519219,-0.37806843061766), 4326))/1000 as distance'), )) ->where ....
Sadly, I couldn't get that to work. I think that I'm going to have to do some bespoke SQL and then use \NearestPoint::fill($data) to populate the objects myself.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community