title: Laravel 5 - Get newly inserted id in transaction?
body: <p>So I am running a transaction that should create a user, and fire off an event to do additional things with the new user id, including creating a settings table where the foreign key user_id in the settings table is the newly created user_id (providing the transaction works of course).</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>DB::beginTransaction();
  
  try {
      DB::table('users')-&gt;insert([
                'email' =&gt; $email,
                'password' =&gt; $password
      ]);
  
      event(new UserWasStored($newUserId)); // How do I get the $newUserId?
  }
  catch(\Exception $e) {
      DB::rollback();
  }
  
  DB::commit();
  </code></pre>
  
  <p>How can I get the <code>$newUserId</code> passed to the event within the transaction?</p>