title: Get the ID of the last attached model
body: <p>I try to get the last ID of an attached model ?</p>
  
  <p>My code is the following to attach the model :</p>
  
  <pre><code>$menu-&gt;pages()-&gt;attach($element['page_id'], array('name' =&gt; $element['name'], 'order' =&gt; $i, 'menu_page_id' =&gt; NULL));
  </code></pre>
  
  <p>But after that, I want to know the ID of the attached model because I have a foreign key "menu_page_id" which is related to the same model.</p>
  
  <p>Any idea how to do that or another way ?</p>
  
  <p>Thanks</p>