title: Laravel ->when() with greater than or lesser than
body: <p>I'd like to run different ->where() condition based to id. </p>
  
  <p>Example what I'm trying to do:</p>
  
  <p>I have joined activity table to interests table and based to ID I'd like to run different where condition. </p>
  
  <pre><code> -&gt;when('activity.id' &lt;= '214469112', function ($q) {
      return $q-&gt;where('interests.type', 'regular');
         }, function ($q) {
         return $q-&gt;where('activity.main', 1);
         })-&gt;get();
  </code></pre>
  
  <p>However ->when() does not seem to respect &lt;= => greater than or less than and returns always false so the  <code>return $q-&gt;where('activity.main', 1);</code> is always used.</p>
  
  <p>Any ideas how I could achieve different ->where() condition based to greater or less than with activity.id? </p>