public function updateBooking() { if (!Request::ajax()) { return "not a json request"; } $post = Input::except('ID'); $index = Input::get('ID'); $notifees = Input::get('Notifees'); $stat = DB::table('Booking')->where('id', $index)->update(array('ShadowStartDate' => $post['ShadowStartDate'], 'ShadowEndDate' => $post['ShadowEndDate'], 'StartDate' => $post['StartDate'], 'EndDate' => $post['EndDate'], 'ForBranch' => $post['ForBranch'], 'Purpose' => $post['Purpose'])); BookingDetails::where('BookingID', $index)->where('Booker', 0)->delete(); if (count($notifees) > 0) { foreach ($notifees as $notifee) { $temp = User::where('email', $notifee['Email'])->first(); if ($temp != null) { $bookingDetail = new BookingDetails(); $bookingDetail->fill(array('BookingID' => $index, 'UserID' => $temp->id, 'Email' => $temp->email, 'Booker' => 0)); $bookingDetail->save(); } else { $bookingDetail = new BookingDetails(); $bookingDetail->fill(array('BookingID' => $index, 'Email' => $notifee['Email'], 'Booker' => 0)); $bookingDetail->save(); } } } // Logs::BookingRequestEdited($post['BookingID'], $post['KitID'], $post['StartDate'], $post['EndDate']); return Response::json(array('success' => true), 200); }