title: passing parameters to a method in a query using whereRaw
body: <p>How can I pass parameters to a method in my query using whereRaw?</p>
  
  <p>I've got 'syntax error, unexpected '.'' when trying to add 'latitude' and 'longitude' which are column names:</p>
  
  <pre><code>public function show($lon, $lat, $radio) {
    $results = Viaje::where($otherStuff)
                    -&gt;whereRaw( 'radio + ' . $radio . ' &lt;= ' . $this-&gt;getDistanceFromLatLonInKm($lat, $lon, . 'latitude, longitude)');
    return response()-&gt;json($results);
  }
  </code></pre>
  
  <p>If I delete that dot, I end up passing 2 floats + 2 strings to my method instead the 4 floats required, so I get error 500.</p>
  
  <pre><code>public function show($lon, $lat, $radio) 
  {   
      $results = Viaje::where($otherStuff)-&gt;whereRaw( 'radio + ' . $radio . ' &lt;= ' . $this-&gt;getDistanceFromLatLonInKm($lat, $lon, 'latitude', 'longitude'));   
      return response()-&gt;json($results); 
  }
  </code></pre>
  
  <p>Edit:</p>
  
  <p>'radio', 'longitude' and 'latitude' are column names containing a float value.</p>
  
  <pre><code>public function getDistanceFromLatLonInKm($lat1,$lon1,$lat2,$lon2) {
    $R = 6371; // Radius of the earth in km
    $dLat = deg2rad($lat2-$lat1);
    $dLon = deg2rad($lon2-$lon1);
    $a = sin($dLat/2) * sin($dLat/2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2))
         + sin($dLon/2) * sin($dLon/2);
    $c = 2 * atan2(sqrt($a), sqrt(1-$a));
    $d = R * c; // Distance in km
    return $d;
  }
  </code></pre>