title: SQL query with Laravel Eloquent and named bindings : mixed named and positional parameters
body: <p>I'm trying to execute the following query. Note I've to use <strong>named parameters</strong> in this query.
  I don't understand the issue because it seems I'm only using named parameters. How can I make named parameters work ? </p>
  
  <blockquote>
    <p>Note : the query is fully functionnal when I'm <strong>executing it in DB</strong> or in laravel with a simple <strong>DB::table(users)->select( $sql_with_values_inside )</strong></p>
  </blockquote>
  
  <p>I'm new to Laravel so maybe I'm doing it wrong.</p>
  
  <p><strong>Query</strong></p>
  
  <pre><code>$latitude = (float)$latitude;
  $longitude = (float)$longitude;
  $radius = (float)$radius;
  
  $sql = '`firstname`,`lastname`,`email`,
       ST_X(`coordinates_public`) AS latitude,
       ST_Y(`coordinates_public`) AS longitude,
       (6371 * ACOS(COS(RADIANS(:latitude)) * COS(RADIANS(ST_Y(coordinates_private))) * COS(RADIANS(ST_X(coordinates_private)) - RADIANS(:longitude)) + SIN(RADIANS(:latitude)) * SIN(RADIANS(ST_Y(coordinates_private))))) AS distance';
  
  $washers = DB::table('users')
      -&gt;selectRaw($sql, ['latitude' =&gt; $latitude,'longitude'=&gt; $longitude,'radius'=&gt; $radius])
      -&gt;whereRaw('MBRContains ( LineString (
          Point (
              :longitude + :radius / (111.320 * COS(RADIANS(:latitude))),
              :latitude + :radius / 111.133
          ),
          Point (
              :longitude - :radius / (111.320 * COS(RADIANS(:latitude))),
              :latitude - :radius / 111.133
          )), `coordinates_private`
      )', ['latitude' =&gt; $latitude,'longitude'=&gt; $longitude,'radius'=&gt; $radius])
      -&gt;having('distance &lt; :radius', ['radius'=&gt; $radius])
      -&gt;orderBy('distance')
      -&gt;get();
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>Illuminate\Database\QueryException: SQLSTATE[HY093]:
  Invalid parameter number: mixed named and positional parameters (SQL: select `firstname`,`lastname`,`email`,
      ST_X(`coordinates_public`) AS latitude,
      ST_Y(`coordinates_public`) AS longitude,
      (6371 * ACOS(COS(RADIANS(:latitude)) * COS(RADIANS(ST_Y(coordinates_private))) * COS(RADIANS(ST_X(coordinates_private)) - RADIANS(:longitude)) + SIN(RADIANS(:latitude)) * SIN(RADIANS(ST_Y(coordinates_private))))) AS distance from `users` where MBRContains (
      LineString
          (
          Point (
              :longitude + :radius / (111.320 * COS(RADIANS(:latitude))),
              :latitude + :radius / 111.133
          ),
          Point (
              :longitude - :radius / (111.320 * COS(RADIANS(:latitude))),
              :latitude - :radius / 111.133
          )
       ),
      `coordinates_private`) having `distance &lt; :radius` = 4.8312518210935 order by `distance` asc)
  </code></pre>