mardi 10 novembre 2015

Troubles whiles access Array element: Undefined offset: 0

I have a object ($project) in Blade.

When I do a {{ var_dump($project) }} I get:

object(stdClass)[603]
  public 'image_header' => 
    array (size=1)
      0 => 
        object(stdClass)[610]
          public 'img' => string 'amsterdam.jpg' (length=13)

When I try to acces this element in blade with:

{{ $project->image_header[0]->img }}

It keeps giving this error:

Undefined offset: 0.

Print_r output

stdClass Object ( [image_header] => Array ( [0] => stdClass Object ( [img] => amsterdam.jpg ) ) )



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire