I am trying to pass multiple arrays to the blade file using the following statement.
public function index()
{
$locations = \App\Models\Location::all();
$peopletypes = config('peopletypes');
$eventtypes = config('eventtypes');
return view('home')->with(compact(['locations' => $locations,
'peopletypes' => $peopletypes,
'eventtypes' => $eventtypes])); // tried removing compact also
}
In the HTML, I am trying to access the following way.
@foreach($eventtypes as $eventtype)
<a class="dropdown-item ml-2"
id="{{ $eventtype['value'] }}" href="#">{{ $eventtype['name'] }}
</a>
@endforeach
It is still saying that $eventtypes
is undefined. Can anyone please tell me what is wrong here?