title: How to get inserted id of pivot when I use attach() in Laravel 5.6 (Eloquent)?
body: <p>I have this tables: <strong>users</strong>, <strong>programs</strong> and <strong>users_programs</strong> (<em>pivot</em>)</p>
  
  <p>I use this sentence to relate users with programs (Many to Many)</p>
  
  <pre><code>$user-&gt;programs()-&gt;attach($program);
  </code></pre>
  
  <p>I want to get id to pivot table <em>users_programs</em>, it's posible? How I return id when save a row?</p>
  
  <p>Thanks</p>