[英]Laravel: cannot access item from a collection
I've got some data returned as a collection from a relationship: 我从关系中以集合形式返回了一些数据:
$item = $this->detailedItems->where('detaileditem_product_id', $productId);
when printing this out I can see the data I'm looking for but when trying to access it: 打印出来时,我可以看到我要查找的数据,但是当尝试访问它时:
$item->detaileditem_id;
or 要么
$item->detaileditem_name;
I'm getting an error: 我收到一个错误:
Exception: Property [detaileditem_id] does not exist on this collection instance. 例外:该集合实例上不存在属性[detaileditem_id]。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.