title: Foreign key is incorrectly formated - Laravel 7 migration
body: <p>This is my first Laravel project and I'm having a hard time defining a table with a many-to-many relationship.</p>
  <p>I want to create a table which will 'link' each teacher from a table with one or more domains they are interested in. Each domain can be linked to multiple teachers.</p>
  <p>I approached the idea this way:</p>
  <pre><code>&lt;?php
  
  use Illuminate\Database\Migrations\Migration;
  use Illuminate\Database\Schema\Blueprint;
  use Illuminate\Support\Facades\Schema;
  
  class teacherAndTheirDomain extends Migration
  {
      /**
       * Run the migrations.
       *
       * @return void
       */
      public function up()
      {
          Schema::create('teacherAndTheirDomain', function (Blueprint $table) {
              $table-&gt;unsignedInteger('teacher_id');
              $table-&gt;unsignedInteger('domain_id');
              
              $table-&gt;foreign('teacher_id')
                    -&gt;references('id')-&gt;on('teachers')
                    -&gt;onDelete('cascade');
              $table-&gt;foreign('domain_id')
                    -&gt;references('id')-&gt;on('domains')
                    -&gt;onDelete('cascade');
          });
      }
  
      /**
       * Reverse the migrations.
       *
       * @return void
       */
      public function down()
      {
          Schema::dropIfExists('teacherAndTheirDomain');
      }
  }
  </code></pre>
  <p>but I get &quot;Can't create table, foreign key constraint is incorrectly formed&quot;.</p>
  <p>Can anybody explain to me what I'm doing wrong, please, and why am I getting this error?</p>
  <p>Thanks :)</p>