php - Laravel live server won't work with eager loading -
i've got code has been working fine on local machine (wamp, php 5.4.3) not on production server (centos, php 5.4.11) , can't see why, offending line of code is:
$sharedlist = sharedlist::with('itemlist') ->where('unique_url', '=', $uniqueurl) ->first();
if remove with() eager loading runs without issue, if don't (and don't need on local machine) this:
argument 2 passed illuminate\database\eloquent\relations\belongsto::match() must instance of illuminate\database\eloquent\collection, instance of itemlist given, called in /home/mgc/public_html/test/vendor/laravel/framework /src/illuminate/database/eloquent/builder.php on line 474 , defined /home/site/public_html/test/vendor/laravel/framework/src/illuminate/database/eloquent/relations/belongsto.php line 154: public function match(array $models, collection $results, $relation)
the relevant relationship info sharedlist model is:
class sharedlist extends ardent { public function itemlist() { return $this->belongsto('itemlist', 'list_id'); }
i don't know if capitalisation issue, in with() method have tried itemlist, itemlist , itemlist.
it ardent issue, have tried replacing extend ardent
extend eloquent
no avail.
your with('itemlist')
correct, should name of function setting relationship. have feeling problem might clause coming after that. try lazy eager loading.
$sharedlist = sharedlist::where('unique_url',$uniqueurl)->get(); $sharedlist->load('itemlist');
Comments
Post a Comment