title: New Laravel Project adding multiple tables with foreign keys at once
body: <p>I started a new laravel application running 5.6 and to stream-line the process I created multiple migrations at once before running migrate.
  I have tons of foreign keys for linking to make my database easily scalable.</p>
  
  <p>My problem is trying to reference foreign keys in databases that come later in the migration. I believe it isn't working because the tables that I'm trying to reference aren't created yet in the order of operations. </p>
  
  <p>Ex:
  <code>create_users_table</code> migration:</p>
  
  <pre><code>$table-&gt;increments('id');
  $table-&gt;string('name');
  $table-&gt;string('email')-&gt;unique();
  $table-&gt;string('password');
  
  $table-&gt;integer('user_id')-&gt;nullable()-&gt;unsigned();
  $table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users');
  
  $table-&gt;integer('type_id')-&gt;nullable()-&gt;unsigned();
  $table-&gt;foreign('type_id')-&gt;references('type_id')-&gt;on('types');
  
  $table-&gt;integer('post_id')-&gt;nullable()-&gt;unsigned();
  $table-&gt;foreign('post_id')-&gt;references('post_id')-&gt;on('posts');
  
  $table-&gt;rememberToken();
  $table-&gt;timestamps();
  </code></pre>
  
  <p>Ex: <code>create_types_table</code> migration:</p>
  
  <pre><code>            $table-&gt;increments('id');
              $table-&gt;string('type');
  
              $table-&gt;integer('user_id')-&gt;nullable()-&gt;unsigned();
              $table-&gt;foreign('user_id')-&gt;references('user_id')-&gt;on('users')-&gt;nullable();
  
              $table-&gt;integer('revenue_id')-&gt;nullable()-&gt;unsigned();
              $table-&gt;foreign('revenue_id')-&gt;references('revenue_id')-&gt;on('revenue')-&gt;nullable();
  
              $table-&gt;integer('hours_id')-&gt;nullable()-&gt;unsigned();
              $table-&gt;foreign('hours_id')-&gt;references('hours_id')-&gt;on('hours')-&gt;nullable();
  
              $table-&gt;integer('project_id')-&gt;nullable()-&gt;unsigned();
              $table-&gt;foreign('project_id')-&gt;references('project_id')-&gt;on('projects')-&gt;nullable();
  
              $table-&gt;integer('type_id')-&gt;nullable()-&gt;unsigned();
              $table-&gt;foreign('type_id')-&gt;references('id')-&gt;on('types');
              $table-&gt;timestamps();
  </code></pre>
  
  <p>I follow this same type of pattern throughout all of my tables. 
  I guess my question is; is this because the tables aren't created yet so there's nothing to reference? Is there a way around this or do I need to restart, create all the tables and then add another migration for each and every table to add in foreign keys?</p>
  
  <p>This could be a stupid question, I'm fairly newish to laravel. This is my first time trying to add relationships this early into an application.</p>