Level 88
Although it's printed as an array, it's still an object. You should be able to run $data_item->subject. The id field works because it's always available on a model ;)
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, every one
I have problem when try to access data in notification, It's really strange with me
@foreach(auth()->user()->unreadNotifications as $notification)
@foreach($notification->data as $data_item)
{{dd($data_item)}}
@endforeach
@endforeach
and here the result:
array:8 [▼
"id" => 43
"created_at" => "2018-03-11 22:59:35"
"updated_at" => "2018-03-11 22:59:35"
"subject" => "Sadgvasdfasd"
"quote" => "asdfasdfasdf
"
"user_id" => 1
"status" => 0
"user" => array:7 [▶]
]
then when I write this:
{{($data_item['id'])}} => result is 43
but when I write this: {{($data_item['subject'])}} => I get this error: "Undefined index: subject.
thanks
Please or to participate in this conversation.