title: Creating new rows from results with ORM
body: <p>I'm using the tables user, plan, and plan details. Where:</p>
  
  <p>User:</p>
  
  <pre><code>public function plan_details()
  {
      return $this-&gt;hasMany('App\Plan_Detail');
  }
  public function plans()
  {
      return $this-&gt;hasMany('App\Plan');
  </code></pre>
  
  <p>Plan:</p>
  
  <pre><code>   public function details()
      {
          return $this-&gt;hasMany('App\Plan_Detail');
      }
  </code></pre>
  
  <p>I'm trying to create a new plan from an existing plan like so:</p>
  
  <pre><code>public function store(Request $request)
  {
      $this-&gt;validate($request, [ 'title' =&gt; 'required',
                                  'description' =&gt; 'required']);
      $input = $request-&gt;all();
  
      $plan_details = Plan_Detail::ofUser()-&gt;get();
      $plan = new Plan($request-&gt;all());
  
      DB::beginTransaction();
      Auth::user()-&gt;plans()-&gt;save($plan);
  
      try {
        foreach ($plan_details as $k =&gt; $plan_detail)
          Plan::find($plan['id'])-&gt;details()-&gt;save($plan_detail);
        DB::commit();
      } catch (Exception $e) {
        Log::error("PGSQL plan detail " . $e-&gt;message());
        DB::rollback();
        session()-&gt;flash('message', 'Error al guardar el plan de entreno');
      }
  
      return redirect('plans');
  }
  </code></pre>
  
  <p>This line does edit the plan details so no longer belong to the old plan and get into the new one: </p>
  
  <blockquote>
    <p>Plan::find($plan['id'])->details()->save($plan_detail);</p>
  </blockquote>
  
  <p>I refactored the code to orm some commits ago and now I discovered this bug, I was doing all fields in an array like before save:</p>
  
  <pre><code>         foreach ($plan_details as $k =&gt; $plan_detail) {
  +          $detail_line['exercise_id'] = $plan_detail['exercise_id'];
             $detail_line['plan_id'] = $plan['id'];
  </code></pre>
  
  <p>I wouldn't like to go back to that, but can't think of how to relation Auth::user with plan and with plan details in this way and creating new items. </p>
  
  <p>If I use User->plan_details() I would need to specify which plan_id.</p>
  
  <p>If I use Plan->details I have to specify user_id</p>
  
  <p>Can't that be done?</p>