Laravel错误 仅在部署时尝试获取非对象的属性"date"



我有一个属于Shipment ModelPackage Model。我这样设置关系

class Package extends Model
{
public function shipment(){
return $this->belongsTo(Shipment::class,'shipment_id','id');
}
}

一切都在localhost中正常工作,但是当我将其部署到heroku时,它向我显示错误

Trying to get property 'date' of non-object
ErrorException
in /app/app/Http/Resources/Package.php (line 19)
'shipment_date'=> $this->shipment->date

你可以试试这个

$this->shipment['date']

相关内容

  • 没有找到相关文章

最新更新