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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -