I have one post, if the post is successful it will output data2 "$ result ['STATUS_CODE'] == 200", how do you pass the newly obtained data to another function?
public function createPassanger(Request $request){
$api = new Api;
$input = $request->all();
$platform = "W";
$id_flight = Session::get('id_flight');
$url = config::get('constants.url')."api/passanger/add";
//this is my post
$post = array(
"passanger_name" => $input['name'],
"passanger_email" => $input['email'],
"passanger_passport" => $input['passport'],
"id_flight" => $id_flight,
"platform" => $platform
);
$result = $api->post($url, $post);
//this is results of the post
if($result['STATUS_CODE'] == 200){
$summary['id_summary'] = $result['DATA']['id_summary'];
$summary['id_passanger'] = $result['DATA']['id_passanger'];
$summary['id_flight'] = $result['DATA']['id_flight'];
$summary['passanger_name'] = $result['DATA']['passanger_name'];
$summary['passanger_passport'] = $result['DATA']['passanger_passport'];
$summary['passanger_email'] = $result['DATA']['passanger_email'];
$summary['order_id'] = $result['DATA']['order_id'];
$summary['check_in'] = $result['DATA']['check_in'];
$summary['status_booking'] = $result['DATA']['status_booking'];
$summary['status'] = $result['DATA']['status'];
$summary['member_id'] = $result['DATA']['member_id'];
$summary['airlines_id'] = $result['DATA']['airlines_id'];
$summary['airlines_name'] = $result['DATA']['airlines_name'];
$summary['flight_no'] = $result['DATA']['flight_no'];
$summary['airport_id'] = $result['DATA']['airport_id'];
$summary['airport_name'] = $result['DATA']['airport_name'];
$summary['pnr_ticket'] = $result['DATA']['pnr_ticket'];
$summary['departure_time'] = $result['DATA']['departure_time'];
$summary['departure_date'] = $result['DATA']['departure_date'];
$summary['bag_amount'] = $result['DATA']['bag_amount'];
$summary['price'] = $result['DATA']['price'];
$summary['code'] = $result['DATA']['code'];
$summary['symbol'] = $result['DATA']['symbol'];
//I don't want to make a session
// Session::put($summary);
Session::flash('defaultSuccess', 'Success');
Session::flash('textDefaultSuccess', ucfirst((strtolower($result['MESSAGE']))));
return redirect()->route('summary');
}else{
Session::flash('defaultFailed', 'Create Summary Failed!');
Session::flash('textDefaultFailed', ucfirst((strtolower($result['MESSAGE']))));
return redirect()->route('passanger');
}
}
this is a function to hold data from the createPassanger function,
public function getDataSummary(){
//function to save the post results from function createPassanger
$data['title'] = "Summary";
return view('v_summary', $data);
}
this is a view from function getDataSummary,I do not want to save the data in the session
<div class="col-12">
<table class="table borderless">
<form action="{{route('payment')}}" method="POST">
@csrf
<input type="hidden" name="order_id" value="{{Session::get('order_id')}}">
<input type="hidden" name="price" value="{{Session::get('price')}}">
<input type="hidden" name="email" value="{{Session::get('passanger_email')}}">
<tr>
<td>Passanger</td>
<td>:</td>
<td>{{Session::get('passanger_name')}}</td>
</tr>
<tr>
<td>Passport</td>
<td>:</td>
<td>{{Session::get('passanger_passport')}}</td>
</tr>
<tr>
<td>Country Issued</td>
<td>:</td>
<td>{{Session::get('airport_name')}}</td>
</tr>
<tr>
<td>Airline</td>
<td>:</td>
<td>{{Session::get('airlines_name')}}</td>
</tr>
<tr>
<td>Flight No</td>
<td>:</td>
<td>{{Session::get('flight_no')}}</td>
</tr>
<tr>
<td>PNR Ticket</td>
<td>:</td>
<td>{{Session::get('pnr_ticket')}}</td>
</tr>
<tr>
<td>Departure Airport</td>
<td>:</td>
<td>{{Session::get('airport_name')}}</td>
</tr>
<tr>
<td>Departure TIme</td>
<td>:</td>
<td>{{Session::get('departure_date')}} {{Session::get('departure_time')}}</td>
</tr>
<tr>
<td>Bag Required</td>
<td>:</td>
<td>{{Session::get('bag_amount')}}</td>
</tr>
<tr>
<td>Price</td>
<td>:</td>
<td>{{Session::get('symbol')}} {{Session::get('price')}}</td>
</tr>
</table>
<button type="submit" class="btn btn-default btn-book btn-block">
<p class="mb-0">NEXT</p>
</button>
</form>
</div>
I have tried several times to get the results data from the post to be saved into getDataSummary but the result is an error of 500