/** * This function add the user selected halls to reserve. * Also this function response with the details of the selected hall. * * @param Request $request * @return \Illuminate\Http\JsonResponse */ function addHallsToReserve(Request $request) { //this is used as a indicator to access the payment page $request->session()->put('CanPay', 'Can'); $inputs = $request->all(); $hall_id = $inputs['hall_id']; $request->session()->put('hall_selected', $hall_id); //retrieve the hall details from the table $hall_detail = HALL::join('HALL_RATES', 'HALL_RATES.hall_id', '=', 'HALLS.hall_id')->where('HALLS.hall_id', '=', $hall_id)->select('HALLS.hall_id', 'HALLS.title', 'HALL_RATES.advance_payment', 'HALL_RATES.refundable_amount')->get(); //retrieve the advance payment of the halls in order to add to the session $advance = DB::table('HALL_RATES')->where('hall_id', '=', $hall_id)->value('advance_payment'); $request->session()->put('total_payable', $advance); return response()->json(['hall_detail' => $hall_detail]); }