title: One to many relationship Laravel migration
body: <p>I currently have a 1:1 relationship and I need it to be a one to many.
  Such that <code>Job Details</code> can have multiple results for 1 <code>Job Search</code>. </p>
  
  <p><strong>Job Searches</strong> </p>
  
  <pre><code>public function up()
  {
      Schema::create('job_searches', function (Blueprint $table) {
          $table-&gt;increments('id');
     });
  }
  </code></pre>
  
  <p><strong>Job Details</strong></p>
  
  <pre><code>public function up()
  {
      Schema::create('job_details', function (Blueprint $table) {
          $table-&gt;integer('job_details_id',11);
          $table-&gt;foreign('job_details_id')-&gt;references('id')-&gt;on('job_searches');    
      });
  }
  </code></pre>
  
  <p>The current output I am getting is:</p>
  
  <pre><code>Job_Search_Id   
  1
  
  Job_Detail_Id
  1
  </code></pre>
  
  <p>When adding another result to the <code>job details</code> I get: </p>
  
  <blockquote>
    <p>Illuminate\Database\QueryException with message 'SQLSTATE[23503]:
    Foreign key violation: 7 ERROR:  insert or update on table
    "job_details" violates foreign key constraint
    "job_details_job_details_id_foreign"</p>
  </blockquote>
  
  <p>I also have stated the relationships in my models</p>
  
  <p><strong>Job Search Model</strong></p>
  
  <pre><code>class JobSearches extends Model
  {
      protected $primaryKey = 'id';
  
      public function job_details(){
            return $this-&gt;belongsToMany('App\job_details');
      }
  }
  </code></pre>
  
  <p><strong>Job Details Model</strong></p>
  
  <pre><code>class JobDetails extends Model
  {
   protected $primaryKey = 'job_details_id';
  
   public function job_search(){
      return $this-&gt;hasOne('App\job_search');
  }
  </code></pre>