简体   繁体   English

Laravel Blade中的回声值

[英]Echo value in Laravel Blade

How can I get the value 'name' under 'rekenplichtige' in my Blade template? 如何在Blade模板的“ rekenplichtige”下获取值“ name”? If I do this: {{ $vestiging->rekenplichtige->name }} I get the following error: ErrorException Trying to get property of non-object 如果我这样做: {{ $vestiging->rekenplichtige->name }}我收到以下错误:ErrorException试图获取非对象的属性

That syntax is working to get the 'naam' under 'gemeente'. 该语法正在使“ gemeente”下的“ naam”起作用。 I have no idea about what's going wrong. 我不知道怎么回事。

在此处输入图片说明

 {{ $vestiging->rekenplichtige}} 

since "name" inside an array, you should array notation to get name. 由于数组中的“名称”,您应该使用数组符号来获取名称。 Like below 像下面

{{ $vestiging->rekenplichtige['name'] }}
{{ $vestiging->rekenplichtige()->first()->name }}

可以了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM