title: select certain columns from eloquent collection after the query has executed
body: <p>Using Laravel 5.3, I have a model with the following function</p>
  
  <pre><code>public function myData() {
      return $this-&gt;hasMany(MyData::class);
  }
  </code></pre>
  
  <p>and in my collection I have the following</p>
  
  <pre><code>$my_data = MyModel-&gt;myData()-&gt;get(); 
  </code></pre>
  
  <p>All good so far. If I <code>return $my_data</code> I get an eloquent collection with three items.</p>
  
  <p>What I need now though is to create a duplicate of that collection but containing only three of the fields.</p>
  
  <p>I have tried several different things, each of which return an error. The following is the closest I have got, but this returns an empty array - I assume because the fields are located one level deeper than the collection object.</p>
  
  <pre><code>$new_collection = $my_data-&gt;only(['field_1', 'field_2', 'field_3']);
  </code></pre>
  
  <p>What would be the correct way to create a new collection containing all three items, each with only the three selected fields?</p>
  
  <p>Thanks for your help</p>