title: Eloquent Join - where closure
body: <p>Is there any way to use closure for <code>where</code> in join clause in Eloquent?</p>
  
  <p>What I'm trying to do is:</p>
  
  <pre><code> $model = $model-&gt;leftJoin('history', function ($join) {
                  $join-&gt;on('history.record_id', '=', 'work_order.work_order_id');
                  $join-&gt;where('history.tablename', '=', 'test');
                  $join-&gt;where('history.columnname', '=', 'column');
  
                  $join-&gt;where(function ($q) {
                      $q-&gt;where('history.value_from', '=', '0')
                          -&gt;orWhere('history.value_from', '=', '');
                  });
  
                  $join-&gt;where('history.value_to', '&gt;', '0');
              });
  </code></pre>
  
  <p>but obviously the part:</p>
  
  <pre><code>$join-&gt;where(function ($q) {
       $q-&gt;where('history.value_from', '=', '0')
         -&gt;orWhere('history.value_from', '=', '');
  });
  </code></pre>
  
  <p>doesn't work because <code>JoinClause</code> doesn't support closure for where</p>