title: One to many relationship saving integer into database laravel
body: <p>I am having some trouble saving the FamilyAge using a one to many relationship. As you can see at the last row, I tried to save 3 different person but for the family age, there is only 1 value appearing instead of 3.  Please point out mistake, thanks in advance and also sorry for the weird words that I saved in the database, I just type in randomly</p>
  
  <p><a href="https://i.stack.imgur.com/wTQJm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wTQJm.png" alt="enter image description here"></a></p>
  
  <p>Personal_info has many family family_info (one to many relationship)</p>
  
  <p>family_info controller:</p>
  
  <pre><code>public function submit(Request $request)
  {
  
    $personal_info = Session::get('data');
  
    $data7 = array();
    $data7['NameOfFamily'] = implode(' , ', $request-&gt;NameOfFamily);
    $data7['Relationship'] = implode(' , ', $request-&gt;Relationship);
    $data7['FamilyAge'] = implode(' , ', $request-&gt;FamilyAge);
    $family_info = new family_info;
    $family_info = family_info::create($data7);
    $family_info-&gt;personal_infos()-&gt;associate($personal_info);
    $family_info-&gt;save();
  
  }
  </code></pre>
  
  <p>personal_info controller:</p>
  
  <pre><code>public function submit(Request $request)
  {
    $data = array();
    $data[Name] = $request-&gt;Name;
    $data['Email'] = $request-&gt;Email;
    $personal_info = personal_info::create($data);
    $personal_info-&gt;push();
    Session::put('data', $personal_info);
  }
  </code></pre>
  
  <p>personal_info model:</p>
  
  <pre><code>class personal_info extends Eloquent
  {
    protected $fillable = array('Name', 'Email');
    protected $table = 'personal_infos';
    protected $primaryKey = 'id';
    public function family-infos() {
    return $this-&gt;hasMany('App\family_info,'user_id');
   }
  </code></pre>
  
  <p>family info model</p>
  
  <pre><code>protected $fillable =     
    array('NameOfFamily','Relationship','FamilyAge','user_id');
  
  public function personal_infos() {
      return $this-&gt;belongsTo('App\personal_info', 'user_id', 'id');
  }
  </code></pre>