public function update($id)
 {
     $today = date("Y-m-d H:i:s");
     $i = Input::all();
     $bookingRemarks = '';
     $addition = 0;
     $deduction = 0;
     if ($i['savethis'] == true) {
         $addition -= $i['price_addition'];
         $deduction += $i['price_deduction'];
     }
     $booking = Booking::where('id', $id)->with('reservedRoom.room.roomDetails')->first();
     //$booking = ReservedRoom::where('id', $id)->with('room.roomDetails')->first();
     $old_status = $booking->status;
     $current_price = $booking->price;
     $current_price += $addition + $deduction;
     if (!empty($booking)) {
         $booking->status = $i['status'];
         if ($i['status'] == 5) {
             $booking->cancelled_at = $today;
             $booking->paid = 0;
             $booking->price = 0;
             $booking->cancelled_remarks = $i['cancelled_remarks'];
         } else {
             if ($i['status'] == 1) {
                 $booking->paid = $i['paid'];
             } else {
                 //$booking->paid=0;
                 $booking->price = $current_price;
                 $booking->cancelled_remarks = '';
                 $booking->cancelled_at = '0000-00-00 00:00:00';
             }
         }
         if ($booking->save()) {
             if ($i['savethis'] == true) {
                 $newBookingRemarks = new BookingRemarksHistory();
                 $newBookingRemarks->additional = $addition;
                 $newBookingRemarks->deduction = $deduction;
                 $newBookingRemarks->remarks = $i['bookingremarks'];
                 $newBookingRemarks->booking_id = $id;
                 $newBookingRemarks->save();
             }
             $roomReserved = ReservedRoom::where('booking_id', $booking->id)->get();
             foreach ($roomReserved as $rr) {
                 $rr->status = $i['status'];
                 $rr->save();
             }
             $a = new Activity();
             $a->actor = Auth::id();
             $a->location = 3;
             $a->logs = 'Updated booking ID of:' . $booking->id . ' by ' . $booking->firstname . ' ' . $booking->lastname . ' from ' . $this->bookingStatus($old_status) . ' to ' . $this->bookingStatus($booking->status);
             //before to after status.
             $a->save();
             return $booking;
         } else {
             return '0';
             //means failed
         }
     }
 }
     $membershipDiscount = null;
     if (isset($i['membership_id'])) {
         $membership = Customer::where('membership_id', $i['membership_id'])->first();
         if ($membership) {
             $membershipDiscount = $membership->current_discount;
         }
     }
     $booking = Booking::where('id', $i['booking_id'])->first();
     if ($booking) {
         $booking->firstname = $i['firstname'];
         $booking->lastname = $i['lastname'];
         $booking->address = $i['address'];
         $booking->contact_number = $i['contact_no'];
         $booking->status = 1;
         $booking->save();
         $reservation = ReservedRoom::where('booking_id', $i['booking_id'])->get();
         if (count($reservation) > 0) {
             foreach ($reservation as $r) {
                 $r->firstname = Input::has('firstname') ? $i['firstname'] : 'WALK-IN';
                 $r->lastname = Input::has('lastname') ? $i['lastname'] : 'WALK-IN';
                 $r->address = Input::has('address') ? $i['address'] : 'WALK-IN';
                 $r->contact_number = Input::has('contact_no') ? $i['contact_no'] : 'WALK-IN';
                 $r->status = 1;
                 if ($r->save()) {
                 }
             }
         }
         return $i;
     }
 });
 Route::get('reports', 'ReportsController@index');