title: Is is possible to make a cross-database foreign key?
body: <p>I made migration with  foreign key 'user_id' to a table 'users' that is in another database: 
  This generates an error when i type (php artisan migrate). </p>
  
  <pre><code> [Illuminate\Database\QueryException]
   SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL
   : alter table `safetyreports` add constraint safetyreports_user_id_foreign
   foreign key (`user_id`) references `users` (`id`) on delete cascade)
  </code></pre>
  
  <p>Now laravel made the table except the 'user_id' column.  How can i accomplish this?</p>
  
  <p>This is my migration code:</p>
  
  <pre><code>Schema::create('safetyreports', function(Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;string('afdeling');
              $table-&gt;string('contractor');
              $table-&gt;string('directe chef');
              $table-&gt;string('ploeg');
              $table-&gt;string('team');
              $table-&gt;string('plant_afd');
              $table-&gt;string('datum');
              $table-&gt;string('plaats');
              $table-&gt;string('tijd');
              $table-&gt;string('omschrijving');
                          $table-&gt;integer('user_id')-&gt;unsigned();
              $table-&gt;foreign('user_id')
        -&gt;references('id')-&gt;on('users')
        -&gt;onDelete('cascade');
              $table-&gt;timestamps();
          });
  </code></pre>
  
  <p>This is my User model code:</p>
  
  <pre><code>protected $connection = 'mysql2';
  protected $table = 'users';
  </code></pre>
  
  <p>I have tested my Users model. It works. I tested it with User:all() and then displaying all the users on my sreen. </p>
  
  <p>Is this making a foreign key cross database tables possible? </p>