title: Eloquent collections methods such as only or except return an empty collection
body: <p>From the <a href="https://laravel.com/docs/5.3/collections#method-only" rel="noreferrer">docs</a>, I have tested the following example with the <code>-&gt;only()</code> method </p>
  
  <pre><code>$collection = collect(['product_id' =&gt; 1, 'name' =&gt; 'Desk', 'price' =&gt; 100, 'discount' =&gt; false]);
  
  $filtered = $collection-&gt;only(['product_id', 'name']);
  
  $filtered-&gt;all();
  
  // ['product_id' =&gt; 1, 'name' =&gt; 'Desk']
  </code></pre>
  
  <p>and it is working indeed.</p>
  
  <p><strong>However</strong>, when I apply that method to a collection I get from the database (Model), </p>
  
  <pre><code>$myCollection = MyModel::orderBy('id','desc')-&gt;paginate(5);
  $filtered=$myCollection-&gt;only(['id']);
          dd(filtered);
  </code></pre>
  
  <p>the collection returned is empty!</p>
  
  <pre><code>Collection {#199 ▼
    #items: []
  }
  </code></pre>
  
  <p>If I <code>dd($myCollection);</code> the collection gotten from the database, it is indeed full of the appends, attributes, and so on stuff. The data appears correctly in the table blade view.</p>
  
  <p>But if I apply either the <code>-&gt;only()</code> or <code>-&gt;except()</code> to <code>$myCollection</code> methods ... the returned collection is empty.</p>
  
  <p>For example, this is the piece of the collection, where I only want to show the <code>id</code> attribute, for example, or some more but not all:</p>
  
  <pre><code>LengthAwarePaginator {#218 ▼
    #total: 3041
    #lastPage: 609
    #items: Collection {#219 ▼
      #items: array:5 [▼
        0 =&gt; MyModel {#220 ▼
          #dates: array:1 [▶]
          #appends: array:5 [▶]
          #connection: null
          #table: null
          #primaryKey: "id"
          #keyType: "int"
          #perPage: 15
          +incrementing: true
          +timestamps: true
          #attributes: array:12 [▼
            "id" =&gt; 3041
            "date" =&gt; "2017-01-25"
            "value1" =&gt; "12"
            "value2" =&gt; "20"
            "value3" =&gt; "22"
            "value4" =&gt; "25"
            "value5" =&gt; "46"
            "value6" =&gt; "48"
            "value7" =&gt; "50"
            "value8" =&gt; "$60,000,000.00"
            "created_at" =&gt; null
            "updated_at" =&gt; null
          ]
  </code></pre>
  
  <p>But when I apply <code>-&gt;only(['id'])</code>, the collection is returned empty.</p>
  
  <p>I have tested it without the paginate and the problem of the empty collection is still the same, so I don't think it has to do with the <code>LengthAwarePaginator</code>.</p>
  
  <p><strong>Workaround</strong>
  Unfortunately I am achieving this the hard way:</p>
  
  <pre><code>    $filtered = collect(['id'=&gt;$myCollection-&gt;pluck(['id']),'Value1'=&gt;$myCollection-&gt;pluck('value1')]);
  dd($filtered);
  </code></pre>
  
  <p>Now I am getting the desired collection where, for example I just want two attributes or columns from the database:</p>
  
  <pre><code>Collection {#212 ▼
    #items: array:2 [▼
      "id" =&gt; Collection {#201 ▶}
      "value1" =&gt; Collection {#211 ▶}
    ]
  }
  </code></pre>
  
  <p>Why is this happening? What am I missing? How can I fix it?</p>