title: Laravel Eloquent - get last insert of related model
body: <p>I have a relationship between two models: <code>Terminal</code> and <code>terminalRent</code>.</p>
  
  <p>A Terminal can have many terminalRents.
  I want to get the last Rent for a specific Terminal.</p>
  
  <pre><code>$lastRent = Terminal::with('terminalRent')-&gt;where('id', $id)-&gt;orderBy('id', 'desc')-&gt;first();
  </code></pre>
  
  <p>When using <code>where()</code> it will reflect those on the <code>Modal</code> hoewever I want to get the last record for terminalRent in relation to the specific terminal. <code>$id</code> is the Id of the terminal and the tables are connected like this:</p>
  
  <pre><code>Terminal
  ----
  ID
  
  
  terminalRent
  -----
  ID
  terminal_id &lt;--- this is the foreign key for the ID of the Terminal Table
  </code></pre>