title: Laravel 5.1 - Join through multiple tables
body: <p>I have the following tables:</p>
  
  <pre><code>Customer
      id
  
  Order
      id
      customer_id
  
  Order_notes
      order_id
      note_id
  
  Notes
      id
  </code></pre>
  
  <p>If I want to get all order notes for a customer so I can do the following, how can I do it? Is there way to define a relationship in my model that goes through multiple pivot tables to join a customer to order notes?</p>
  
  <pre><code>@if($customer-&gt;order_notes-&gt;count() &gt; 0)
      @foreach($customer-&gt;order_notes as $note)
          // output note
      @endforeach
  @endif
  </code></pre>