title: Laravel foreach undefined array key 1
body: <p>Im trying to update a column on all the data using a db seeder but I keep getting:
  <strong>Undefined array key 1</strong></p>
  <p>I checked the $key on the foreach and it's value is 0.</p>
  <pre><code>Application::chunk(500, function($applications) {
      foreach($applications as $application){
          $questions = $application-&gt;vacancy-&gt;questions()-&gt;pluck('id')-&gt;toArray();
          if(!empty($questions)){       
              foreach ($application-&gt;answers ?? [] as $key =&gt; $value) {
                  $value-&gt;update(
                      [
                          'vacancy_question_id' =&gt; $questions[$key]
                      ]
                  );
              }
          }
      }
  });
  </code></pre>
  <p><strong>Update</strong></p>
  <p>Here's the relationship for application and answers</p>
  <pre><code>/**
   * Get the answers for the application.
   *
   * @return \Illuminate\Database\Eloquent\Relations\HasMany
   */
  public function answers()
  {
      return $this-&gt;hasMany(Answer::class);
  }
  </code></pre>