title: Laravel migrate one to one relationships error
body: <p>I have a question regarding laravel migration table. I have a relation one to one between 2 tables. OrderLine and Ticket. I have put these 2 function in the model Ticket and OrderLine:</p>
  
  <pre><code>public function orderline()
  {
      return $this-&gt;hasOne('App\OrderLine');
  
  } 
  
  public function ticket()
  {
      return $this-&gt;hasOne('App\Ticket');
  }    
  </code></pre>
  
  <p>and in migrations file create_tickets_table the Schema :</p>
  
  <pre><code>public function up()
  {
      Schema::create('tickets', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;integer('order_line_id')-&gt;unsigned(); //foreign key
          $table-&gt;string('number');
          $table-&gt;float('price');
          $table-&gt;timestamps();
  
          $table-&gt;foreign('order_line_id')-&gt;references('id')-&gt;on('order_lines');//relationship  one to one between orderline &amp; ticket tables
      });
  }
  </code></pre>
  
  <p>and in migrations file create_order_lines_table the Schema :</p>
  
  <pre><code>  public function up()
  {
      Schema::create('order_lines', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;integer('ticket_id')-&gt;unsigned();//foreign key
          $table-&gt;integer('order_id')-&gt;unsigned(); //foreign key
          $table-&gt;float('total_order_line');
          $table-&gt;timestamps();
  
          $table-&gt;foreign('ticket_id')-&gt;references('id')-&gt;on('tickets');//relationship  one to one between orderline &amp; ticket tables
  
          $table-&gt;foreign('order_id')// relationship one to many between order &amp; order line tables
          -&gt;references('id')-&gt;on('orders')
              -&gt;onDelete('cascade');
      });
  }
  </code></pre>
  
  <p>and when i do php artisan migrate I still have have this error :</p>
  
  <p>bruno@bruno-HP-EliteBook-840-G4:~/projetconcert$ php artisan migrate
  Migration table created successfully.</p>
  
  <p>Illuminate\Database\QueryException  : SQLSTATE[HY000]: General error: 1005 Can't create table <code>gestion_concert_spectacle</code>.<code>#sql-e08_30d</code> (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table <code>order_lines</code> add constraint <code>order_lines_ticket_id_foreign</code> foreign key (<code>ticket_id</code>) references <code>tickets</code> (<code>id</code>))</p>
  
  <p>Does somebody have any idea how to solve it ? Thank you. Bruno</p>