php - 此集合实例上不存在属性 [x] 使用 with() 和多态
问题描述
Property [status] does not exist on this collection instance
当我尝试获取列的值时出现此错误,这是我的代码
$lab = Lab::select('id', 'services_cat_id', 'resp_doctor_id', 'invoice_id', 'xray_file', 'status', 'note')->where('patient_id', '3')
->with(['invoice' => function ($q) {
$q->select('invoiceable_id','id', 'code', 'status');}])
->orderBy('status', 'ASC')
->get();
在刀片中:
@foreach ($lab as $item)
{{$item->invoice->status}}
解决方案
推荐阅读
- groovy - sed command won't replace my string when executed form Jenkins
- tsql - TSQL - struggling with simple where condition
- angular - PrimeNG 多选 onItemClick 在更新到 7 后不起作用
- r - 如何在 rstudio 中使用 stargazer 修复“if (nchar(text.matrix[r, c]) > max.length[real.c]) { : 缺少 TRUE/FALSE 的值”中的错误?
- python - 使用 tensorboard 进行 keras 训练可视化
- javascript - SummernotedirtyForm
- vegan - ordiplot3d 颜色按治疗/类别
- java - Spring boot:带占位符的属性文件
- wordpress - 使用有限的预算:网站建设者与自定义构建与其他东西
- c++ - 本地对象的 ScaleTransform GDI+