php - Laravel method attributesToArray() not running on production -


i'm deploying application production environment , it's not working expected. i've narrowed issue down 1 line inside loop in controller;

foreach($temp_table_data $a_payment) {   //array_push($payments, $a_payment->payment); //big collection object   array_push($payments, $a_payment->payment->first()->attributestoarray()); //smaller object } 

the error call member function attributestoarray() on non object. seems crazy because - old saying goes - works fine on machine.

my dev. environment ubuntu trusty64 on php 5.5.21 , production redhat linux php 5.5.11. thought these differences minor (maybe i'm wrong?).

if print_r($temp_table_data() big collection returned. same on both servers. @ point stops liking either payment (that's method) or first()

here partial of temptable.php model payment method;

public function payment(){     return $this->hasmany('app\models\payment', 'vendor zip', 'postcode'); } 

and payment.php model (part of it);

class payment extends model {  protected $table = 'headquarters_data';  public function temptable() {     return $this->belongsto('app\models\temptable', 'postcode', 'vendor zip'); } 

one of temptable models doesnt have payment , attributestoarray() method failing.

try , see if works.

foreach($temp_table_data $a_payment) {     $payment =  $a_payment->payment->first();     if(!is_null($payment)){           $payments[] = $payment->attributestoarray();     } } 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -