title: Laravel 5 - How to insert rows to multiple tables on user registration
body: <p>How would I insert rows to multiple tables when a user gets registered. </p>
  
  <p>I have the basic Laravel user table. I also have a businesses table (id, business_name) and a usersbusinesses table (id, user_id, business_id)</p>
  
  <p>First, I need to create (db insert) the user and get its generated id value.</p>
  
  <p>Then, I need to create (db insert) the business and get its generated id value.</p>
  
  <p>Finally, I need to create (db insert) a row in the usersbusinesses table using the values above (user_id and business_id)</p>
  
  <p>I know I’m going to have to modify the app/Services/Registrar.php file, I just don’t know how to tackle this. Current code only inserts to users table:</p>
  
  <pre><code>/**
   * Create a new user instance after a valid registration.
   *
   * @param  array  $data
   * @return User
   */
  public function create(array $data)
  {
      return User::create([
          'first_name' =&gt; $data['first_name'],
          'last_name' =&gt; $data['last_name'],
          'email' =&gt; $data['email'],
          'password' =&gt; bcrypt($data['password']),
      ]);
  }
  </code></pre>
  
  <p>Thanks
  Christian</p>