试图在Laravel捕获ID时未定义的常数
我在Laravel中具有下面运行此代码的Laravel功能,
$data = AnggotaModel::where([
['status_nikah','Menikah'],
['jk','Pria']
])->get();
是从DD($ DATA)捕获的屏幕。
我想要的是捕获ID结果
$id = $data[id];
是结果,它最终出现错误,
我该怎么办来修复此错误?
I have a function in Laravel which running this code below
$data = AnggotaModel::where([
['status_nikah','Menikah'],
['jk','Pria']
])->get();
below is the screenshoot captured from dd($data);
What I want is to catch the id so I use this code
$id = $data[id];
as the result, it ends up with an Error
What should I do to fix this error??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

get()
方法为您提供了项目的收集。获取首先元素,然后使用$ data [id]
。在这里,您应该将其更改为:
The
get()
method gives you a collection of items. Get the first element then use$data[id]
.Here you should change it to: