public function saveReservationDetails($check_in, $check_out, $no_of_nights, $customer_id) { //predefined check in and check out times $arr_dep_time = DB::table('HOTEL_INFO')->select('check_in', 'check_out')->first(); $check_in_time = $arr_dep_time->check_in; $check_out_time = $arr_dep_time->check_out; //create a carbon timestamp instance merging the dates and time $check_in_datetime = Carbon::createFromTimestamp(strtotime($check_in . $check_in_time)); $check_out_datetime = Carbon::createFromTimestamp(strtotime($check_out . $check_out_time)); //creates a instance of the ROOM_RESERVATION model $reservation = new ROOM_RESERVATION(); //store the details $reservation->check_in = $check_in_datetime; $reservation->check_out = $check_out_datetime; $reservation->adults = session('adults'); $reservation->children = session('kids'); $reservation->num_of_rooms = session('rooms'); $reservation->num_of_nights = $no_of_nights; $reservation->total_amount = session('total_payable'); $reservation->cus_id = $customer_id; $reservation->status = config('constants.RES_PENDING'); if (Session::has('promo_code')) { $reservation->promo_code = session('promo_code'); } $reservation->save(); //get the last added reservation id $res_id = $reservation->room_reservation_id; return $res_id; }