vendredi 29 avril 2016

Laravel 5.0 can't parse array to view

Can't parse array to view.

Here is the array

 Array (
    [positions] => Array
        (
            [0] => Array
                (
                    [id] => 1
                    [company_id] => 1
                    [title] => Software Developer
                )

            [1] => Array
                (
                    [id] => 2
                    [company_id] => 2
                    [title] => Accountant
                )

            [2] => Array
                (
                    [id] => 3
                    [company_id] => 3
                    [title] => Insurance salesman
                )
        )
)

this is the controller

$data = array(
    'positions' => $newarray['data']
);
return view('mypage', $data);

and this is the view where i try to echo the title

@foreach($positions as $position)
<br>
@endforeach

i get this error in the view "Trying to get property of non-object"



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1WuElNT
via IFTTT

Aucun commentaire:

Enregistrer un commentaire