So I'm having this weird output behaviour on Laravel. I pass to the view this object $family
stdClass Object
(
[idFamily] => 17
[name] => Gomes
[people] => Illuminate\Support\Collection Object
(
[items:protected] => Array
(
[0] => stdClass Object
(
[idPerson] => 3623
[name] => Afonso
[imageCover] => stdClass Object
(
[idImage] => 39261
[file] =>
[size] =>
)
)
[1] => stdClass Object
(
[idPerson] => 3623
[name] => Paulo
[imageCover] => stdClass Object
(
[idImage] => 39264
[file] =>
)
)
)
)
)
If I echo out $family->idFamily it works ok. Then I do
<?php
foreach ($family->people as $k => $person) {
echo $person->imageCover->idImage. '<br>';
}
?>
Should output:
39261
39264
But it gives me: Trying to get property of non-object (View: /home/vagrant/Code/ ...)
with @foreach ... @endforeach also doesn't work BUT When doing a dd($person->image->idImage) outputs the values wanted.
This is driving me insane... any help ?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2wuPBWK
via IFTTT
Aucun commentaire:
Enregistrer un commentaire