Pass variables to the Laravel view 5.7

0

I tell you I am trying to pass the data of an array to a view but I can not specify this is the controller code

$lists = array(["name" => "Cerchas", "status" => "1"],
                            ["name" => "Ventanas", "status" => "2"]
            );
return view('batch.index', compact($lists));

Go the view code

@foreach ($lists as $list)
    {{$list->status}}
@endforeach
    
asked by Enrique A. Díaz Barrios 13.12.2018 в 17:49
source

1 answer

1

Being an arrangement and not a collection, what you are going through must change the method by which you access it, thus remaining

@foreach ($lists as $list)
  {{$list['status']}}
@endforeach
    
answered by 13.12.2018 / 20:03
source