title: Laravel - inserting foreign keys causes Integrity constraint violation
body: <p>I have two related models <code>Domain</code>and <code>Server</code>. I'm trying to insert data to my tables using a form. here is my store function : </p>
  
  <pre><code>public function store(Request $request, Domain $domain, Server $server)
  {
      $domain-&gt;create($request-&gt;all());
  
      $server-&gt;domain()-&gt;associate($domain);
      $server-&gt;save();
      $server-&gt;create($request-&gt;only(['srv_hostname','srv_ip','srv_port']));
  
      return redirect()-&gt;route('domains.index');
  }
  </code></pre>
  
  <p>the table <code>servers</code> has a FK <code>domain_id</code> that points to the PK <code>domain.id</code>
  Once I submit my form i get the error : </p>
  
  <blockquote>
    <p>SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'domain_id' cannot be null (SQL: insert into <code>servers</code> (<code>domain_id</code>, <code>updated_at</code>, <code>created_at</code>) values (, 2015-11-25 10:55:45, 2015-11-25 10:55:45))</p>
  </blockquote>
  
  <p>It seems like fk is not correctly linked to the pk..but I don't know how to solve this. thanks :)</p>
  
  <p><strong>Notes :</strong></p>
  
  <p>1 - My 2 related models:</p>
  
  <pre><code>Class Server extends Eloquent {
      public function domain(){
      return $this-&gt;belongsTo('Domain');
     }
  // $fillable and stuff..
  }
  </code></pre>
  
  <p>-</p>
  
  <pre><code>Class Domain extends Eloquent {
      public function servers(){
      return $this-&gt;hasMany('Server');
  }
  //
  }
  </code></pre>
  
  <p>2 - My tables are related:</p>
  
  <pre><code>Schema::table('servers', function($table){
      $table-&gt;foreign('domain_id')
          -&gt;references('id')
          -&gt;on('domains')
          -&gt;onDelete('cascade');
  });
  </code></pre>