$salons = Salon::select(\'salons.*\')
->selectRaw(\'( 6371* acos( cos( radians(?) ) *
cos( radians( lat ) )
* cos( radians(
Try below query
$data = DB::table('salons AS S')
->selectRaw("
( FLOOR(6371 * ACOS( COS( RADIANS( '$lat' ) ) * COS( RADIANS( S.lat ) ) * COS( RADIANS( S.lng ) - RADIANS( '$lng' ) ) + SIN( RADIANS( '$lat' ) ) * SIN( RADIANS( S.lat ) ) )) ) distance")
->havingRaw("distance < 25")
->where("category_Id" , "=" , $id)
->get();
$lat, $lng are variables.