I have setup a system that relies on the routes.php and I have now come across a problem which is that I need to pass a variable to a route which redirects to a controller and receive that variable in the controller. Is this possible. Thanks
Main Controller return redirect()->route('ROUTENAME')->with("Variable", Array);// Variable has to come from here web.php Route::get('ROUTE', "FUNCTION")->name('ROUTENAME');//Need to receive the array here and pass it on RecieveFunction $Variable;//This was passed from Main Controller and forwarded from the route
Advertisement
Answer
You can use session()->get(‘Variable’); in the RecieveFunction