title: How to insert multiple rows from a single query using eloquent/fluent
body: <p>I have the following query:</p>
  
  <pre><code>  $query = UserSubject::where('user_id', Auth::id())-&gt;select('subject_id')-&gt;get();
  </code></pre>
  
  <p>and as expected I get the following result:</p>
  
  <pre><code>[{"user_id":8,"subject_id":9},{"user_id":8,"subject_id":2}]
  </code></pre>
  
  <p>Is there a way of copying the above result into <strong>another table</strong> so that my table looks like this?</p>
  
  <pre><code>ID|user_id|subject_id
  1 |8      |9
  2 |8      |2
  </code></pre>
  
  <p>The problem I have is that the <code>$query</code> can expect any number of rows and so im unsure how to iterate through an unknown number of rows. </p>