title: How to handle two whereRaw condition with column aliases in Laravel framework?
body: <blockquote>
    <p>I am using below queries</p>
  </blockquote>
  
  <pre class="lang-php prettyprint-override"><code>if($a != "") {
      $getData = DB::table('students')
      -&gt;whereRaw("code = :code AND class != :class AND gender = :gender", ["code" =&gt; 1, "class" =&gt; "General", "gender" =&gt; "m"])-&gt;get(['code as c', 'class as c','students.*']);
  }
  
  if($b != '') {
      $queryData=$getData-&gt;whereRaw(" ST_Distancesphere(geom,ST_SetSRID(ST_MakePoint(:longt, :latt), 4326)) &lt; :b", ["longt" =&gt; $longt, "latt" =&gt; $latt, "b" =&gt; $b])-&gt;get();
  } 
  
  return $queryData;
  </code></pre>
  
  <blockquote>
    <p>when $a !='' this condition is true in that case query run perfectly
    but when second case is true $b!='' in that case give me an error
    Method Illuminate\Support\Collection::whereRaw does not exist.</p>
  </blockquote>