title: Laravel method attributesToArray() not running on production
body: <p>I'm deploying my application to my production environment and it's not working as expected. I've narrowed the issue down to one line inside this loop in my controller;</p>
  
  <pre><code>foreach($temp_table_data as $a_payment) {
    //array_push($payments, $a_payment-&gt;payment); //big collection object
    array_push($payments, $a_payment-&gt;payment-&gt;first()-&gt;attributesToArray()); //smaller object
  }
  </code></pre>
  
  <p>The error I get is <code>call to a member function attributesToArray() on a non object</code>. This seems crazy to be because - as the old saying goes - it works fine on my machine.</p>
  
  <p>My dev. environment is Ubuntu trusty64 on PHP 5.5.21 and my production is RedHat Linux PHP 5.5.11. I thought these differences were very minor (maybe I'm wrong?).</p>
  
  <p>If I do a <code>print_r($temp_table_data()</code> then I get a big collection returned. The same on both servers. So at some point it just stops liking either <code>payment</code> (that's a method) or <code>first()</code></p>
  
  <p>Here is partial of my TempTable.php Model with the payment method;</p>
  
  <pre><code>public function payment(){
      return $this-&gt;hasMany('App\Models\Payment', 'Vendor ZIP', 'postcode');
  }
  </code></pre>
  
  <p>And my <code>Payment.php</code> model (part of it);</p>
  
  <pre><code>class Payment extends Model {
  
  protected $table = 'headquarters_data';
  
  public function tempTable()
  {
      return $this-&gt;belongsTo('App\Models\TempTable', 'postcode', 'Vendor ZIP');
  }
  </code></pre>