title: How is a pivot table created by Laravel?
body: <p>In Laravel 4, when working with many-to-many relationships as described in <a href="https://laravel.com/docs/4.2/eloquent#many-to-many" rel="noreferrer">the 4.2 docs</a>, how can I actually get Laravel to create the pivot table for me? </p>
  
  <p>Do I need to add something in my migrations for the two models that are involved? Do I need to manually create a migration for the pivot table? Or how does Laravel know to create the pivot table?</p>
  
  <p>All I've done so far is add the <code>belongsToMany</code> information to the two respective models, i.e.</p>
  
  <pre><code>class User extends Eloquent 
  {
      public function roles()
      {
           return $this-&gt;belongsToMany('Role');
       }
   }
  </code></pre>
  
  <p>However, that does not trigger creation of the pivot table. What step am I missing?</p>