How to write nested joins with Laravel Query builder?
<p>I have SQL query with next join order (two <code>JOIN</code>'s are nested in <code>LEFT JOIN</code>):</p>

<pre><code>SELECT *
FROM mytable
LEFT JOIN table1
  JOIN table2 ON table2.id = table1.document_id
  JOIN table3 ON table3.content_id = table2.id
ON table1.link_id = mytable.link_id
</code></pre>

<p>How to write this query with Laravel Query builder?</p>

<p>My way:</p>

<pre><code>$query = Mytable::select('*')
    -&gt;leftJoin(DB::raw('table1
        JOIN table2 ON table2.id = table1.document_id
        JOIN table3 ON table3.content_id = table2.id
    '), 
    'table1.link_id', '=', 'mytable.link_id');
</code></pre>

<p>It works, but is any way to do it without DB::raw()? Maybe with <code>$join-&gt;nest()</code>?</p>