Sunday, April 16, 2017

Sending an array with compact to the view

I have an array like this:

$currentSelection = array('category' => $request->category, 'location' => $request->location);

When I send this to view like this:

return view('index', compact('currentSelection'));

I get this message:

undefined variable currentSelection

How can I send the array properly with compact()?



via Eisenheim

Advertisement