title: Eloquent / Laravel: How to get last insert/update ID/instance of updateOrCreate()?
body: <p>The title is mostly self-explanatory. Eloquent has a method called</p>
  
  <blockquote>
    <p><code>updateOrCreate()</code></p>
  </blockquote>
  
  <p>documented here: <a href="https://laravel.com/docs/5.5/eloquent#other-creation-methods" rel="noreferrer">https://laravel.com/docs/5.5/eloquent#other-creation-methods</a></p>
  
  <p>In some cases this is really useful. However after doing <code>updateOrCreate()</code> I need either the updated/created object or its primary key or its id.</p>
  
  <p>Of course I could do <code>MyModel::where(...)-&gt;first()</code> and give all those data again but this is clumsy and may be some expensive request.</p>
  
  <p>However <code>updateOrCreate()</code> only returns <strong>true</strong> or <strong>false</strong>.</p>
  
  <p>Any ideas?</p>