Re,
I have the following query:
$property =
Property::select(
DB::raw(\"title, lat, lng, (
3959 * acos(
co
Old question, but if we have to repeat a variable, we have to change its key value in the bindings array.
$property = Property::select(
DB::raw("title, lat, lng, ( 3959 * acos( cos( radians(:lat) ) *
cos( radians( lat ) ) * cos( radians( lng ) - radians(:lng) ) +
sin(radians(:lat_i) ) * sin( radians( lat ) ) ) ) AS distance"),
["lat" => $lat, "lng" => $lng, "lat_i" => $lat]);
That's enough.