Can’t access object values in Laravel blade loop

I’m facing strange behavior when trying to access object values in Laravel blade.

My data looks like the following:

<?php


array:11 [▼
"Monday, 18.10.2022" => array:6 [▶
1 => array:1 [▶
0 => {#1532 ▶
+"id": 252
+"status": 1
+"heading": "Online Event für Test #1"
+"customer": "Test #1"
+"event_type_id": 12
+"slug": "event_11111"
+"datetime": "2021-12-18 10:00:00"
+"name": "Online Event"
+"duration": 3
}
]
2 => array:1 [▶
0 => {#1501 ▶
+"id": 252
+"status": 1
+"heading": "Online Event für Test #1"
+"customer": "Test #1"
+"event_type_id": 12
+"slug": "event_11111"
+"datetime": "2021-12-18 10:00:00"
+"name": "Online Event"
+"duration": 3
}
]
3 => []
5 => []
6 => []
31 => []
]
"Tuesday, 19.10.2022" => array:6 [▶
1 => []
2 => []
3 => []
5 => []
6 => []
31 => []
]
"Wednesday, 20.10.2022" => array:6 [▶
1 => []
2 => []
3 => []
5 => []
6 => []
31 => []
]
"Thursday, 21.10.2022" => array:6 [▶
1 => []
2 => []
3 => []
5 => []
6 => []
31 => []
]
"Friday, 22.10.2022" => array:6 [▶
1 => array:1 [▶
0 => {#1637 ▶
+"id": 253
+"status": 1
+"heading": "Online Event für Test #2"
+"customer": "Test #2"
+"event_type_id": 12
+"slug": "event_22222"
+"datetime": "2021-12-22 14:00:00"
+"name": "Online Event"
+"duration": 5
}
]
2 => array:1 [▶
0 => {#1615 ▶
+"id": 253
+"status": 1
+"heading": "Online Event für Test #2"
+"customer": "Test #2"
+"event_type_id": 12
+"slug": "event_22222"
+"datetime": "2021-12-22 14:00:00"
+"name": "Online Event"
+"duration": 5
}
]
3 => []
5 => []
6 => []
31 => []
]
"Saturday, 23.10.2022" => array:6 [▶
1 => []
2 => []
3 => []
5 => []
6 => []
31 => []
]
....

And my blade file like this:

<?php

@foreach($overview_pivot as $datetime => $users)
<tr>
<td></td>
@foreach($users as $user_id => $user_events_array)
<td>
@foreach($user_events_array as $events)
<ul class="list-group list-group-flush" data-toggle="checklist">
@foreach($events as $event)

//Works fine


//Error


@endforeach
</ul>
@endforeach

</td>
@endforeach
</tr>

@endforeach

Problem:

When I try accessing the object everything works fine, but when I try to echo object values (e.g. ). I get the error “Trying to get property ‘id’ of non-object”.

Any idea what’s wrong with my code?

from Newest questions tagged laravel-5 – Stack Overflow https://ift.tt/3aThw3H
via IFTTT

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.