jeudi 20 octobre 2016

Undefined property: stdClass:: error in Laravel 5.1

I got an error when i trying to print a value of an array in my Laravel Application.Please take a look.

My Controller:

public function index()
{
    //
    $data = new Userflow();
    $result = $data->gobalsCount();
    $res = $data->yrLogins;
    $res1 = $data->mnLogins;
    $res2 = $data->dayLogins;
    $res3 = $data->hrLogins;
    $res4 = $data->minLogins;
    $res5 = $data->secLogins;
    $object = [$res,$res1,$res2,$res3,$res4,$res5];

   //dd($object);
    return view('userflow',compact('object'));
}

My blade template:

  @foreach($object as $value)
  <td></td>                 
  @endforeach

In this way i got this type of error.If i var_dump($object) then it returns:

array:6 [▼
  0 => array:1 [▼
    0 => {#1396 ▼
      +"avg": "2.0000"
    }
  ]
  1 => array:1 [▶]
  2 => array:1 [▶]
  3 => array:1 [▶]
  4 => array:1 [▶]
  5 => array:1 [▶]
]

Any help will be appreciated.Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire