title: Laravel save nested model hasManyThrough
body: <p>I have 3 models </p>
  
  <pre><code>Event has many Shifts
  
  Shift belongs to Event
  
  Shift has many ShiftWorkers
  
  ShiftWorker belongs to Shift
  </code></pre>
  
  <p>when i get to save all models at once through html form with this store method in controller:</p>
  
  <pre><code>public function store(EventsForm $request)
  {
      //dd($request-&gt;all());
  
      // save event
      $event = Auth::user()-&gt;events()-&gt;create($request-&gt;all());
  
      $total_shifts = count($request-&gt;shift_start);
  
      $shifts = [];
  
      for ($s = 0; $s &lt;= $total_shifts-1; $s++ ) {
          array_push($shifts, new Shift(['shift_start' =&gt; $request-&gt;shift_start[$s], 'shift_end' =&gt; $request-&gt;shift_end[$s]]));
      }
  
      // save shifts
      $event-&gt;shifts()-&gt;saveMany($shifts);
  
      $workers = [];
  
      for ($w = 0; $w &lt;= $total_shifts-1; $w++ ) {
  
          array_push($workers, new ShiftWorker(['quantity' =&gt; $request-&gt;quantity[$w], 'hour_wage' =&gt; $request-&gt;hour_wage[$w]]));
  
      }
  
      // save workers
      $event-&gt;shifts()-&gt;shift_workers()-&gt;saveMany($workers);
  </code></pre>
  
  <p>i get this error</p>
  
  <p>Call to undefined method Illuminate\Database\Query\Builder::shift_workers()</p>
  
  <p>How can i save my third Model (ShiftWorker) ?</p>