Undefined property: stdClass: (error happens, though one result is dumped)

Posted 3 months ago by midwestdev

Basic script loops through array, works perfect when more than one result. But if there is one result, it gives me Undefined property: stdClass:

         @foreach($datum->CONTACT_INFO as $contact_data)
                 <li type="{{ $contact_data['TYPE'] }}">{{ $contact_data['INFO'] }}</li>
             @endforeach

dd returns

array:1 [▼
  0 => array:2 [▼
    "INFO" => "5555551212"
    "TYPE" => "phone"
  ]
]

var_dump returns

Undefined property: stdClass::$CONTACT_INFO

What am I missing here?

Please sign in or create an account to participate in this conversation.