title: Laravel 5.1 Migration and Seeding Cannot truncate a table referenced in a foreign key constraint
body: <p>I'm trying to run the migration (see below) and seed the database, but when I run</p>
  
  <pre><code>php artisan migrate --seed
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Migration table created successfully.
  Migrated: 2015_06_17_100000_create_users_table
  Migrated: 2015_06_17_200000_create_password_resets_table
  Migrated: 2015_06_17_300000_create_vehicles_table
  
  [Illuminate\Database\QueryException]
  SQLSTATE[42000]: Syntax error or access violation: 1701 Cannot truncate a table
  referenced in a foreign key constraint (`app`.`vehicles`, CONSTRAINT `vehic
  les_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `app`.`users` (`id`
  )) (SQL: truncate `users`)
  
  [PDOException]
  SQLSTATE[42000]: Syntax error or access violation: 1701 Cannot truncate a table
  referenced in a foreign key constraint (`app`.`vehicles`, CONSTRAINT `vehic
  les_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `app`.`users` (`id`
  ))
  </code></pre>
  
  <p>I looked up what this error is supposed to mean, and also found <a href="https://stackoverflow.com/questions/29119272/laravel-eloquent-truncate-foreign-key-constraint">examples</a> of other people running into the same problem, even just related to using <a href="https://stackoverflow.com/questions/5452760/truncate-foreign-key-constrained-table">MySQL</a>, and their solutions, but applying:</p>
  
  <pre><code>DB::statement('SET FOREIGN_KEY_CHECKS=0;'); and 
  DB::statement('SET FOREIGN_KEY_CHECKS=1;'); 
  </code></pre>
  
  <p>Within down() doesn't seem to work and when I run describe in MySQL the tables look right.</p>
  
  <p>The migrations are named properly to make sure the users table is migrated first, and then vehicles so the foreign key can be applied, and the tables being setup up correctly suggests the migrations were run, but then the error occurs.  I dropped and recreated the DB and tried it again and it is the same result.  I also don't understand why it is trying to truncate on the first migration and seed of the database, I wouldn't have thought that would occur when you tried to run php artisan migrate:refresh --seed.</p>
  
  <pre><code>// 2015_06_17_100000_create_users_table.php
  
  class CreateUsersTable extends Migration
  {
      public function up()
      {
          Schema::create('users', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;string('username', 60)-&gt;unique();
              $table-&gt;string('email', 200)-&gt;unique();
              $table-&gt;string('password', 255);
              $table-&gt;string('role')-&gt;default('user');
              $table-&gt;rememberToken();
              $table-&gt;timestamps();
          });
      }
  }
  
  public function down()
  {
      Schema::drop('users');
  }
  
  // 2015_06_17_300000_create_vehicles_table.php
  
  class CreateVehiclesTable extends Migration
  {
      public function up()
      {
          Schema::create('vehicles', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;integer('user_id')-&gt;unsigned();
              $table-&gt;string('make');
              $table-&gt;string('model');
              $table-&gt;string('year');
              $table-&gt;string('color');
              $table-&gt;string('plate');
              $table-&gt;timestamps();
  
              $table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users');
          });
      }
  }
  
  public function down()
  {
      Schema::drop('vehicles');
  }
  </code></pre>