I'm trying to pass the value of an array from one method to another method in Laravel. Basically I have a method called orderingSubmission that recieves an array from an Ajax POST execution (that part works fine), but then I'm trying to pass the array values to another method called orderingSubmissionReceipt so I can finally render the view on order-summary page. I'm using sessions but they don't seem to work. Can anyone tell me what I'm missing please?
Here's my route.php
Route::get('/', function() { return redirect('home'); });
Route::get('home', 'HomeController@home');
Route::post('home', 'HomeController@activateCustomer');
Route::post('order-summary', 'HomeController@OrderingSubmission');
Route::get('order-summary', 'HomeController@orderingSubmissionReceipt');
HomeController.php
public function orderingSubmission(Request $request)
{
$allValues2 = $request->get('users'); // This code works fine. It gets the array
Log::info('This is orderingSubmission.....: ' . print_r($allValues2, true));
Session::set('allValues2',$allValues2);
}
public function orderingSubmissionReceipt()
{
$allValues3 = Session::get('allValues2'); // This code is not getting the session value
Log::info('This is orderingSubmissionReceipt.....: ' . print_r($allValues3, true));
return view('order-summary', [
'people' => $allValues3
]);
}