public function postBillingOtherSave() { $id = Input::get('other_billing_id'); $query = Billing_core::find($id); $data = array('eid' => '0', 'pid' => Session::get('pid'), 'dos_f' => Input::get('dos_f'), 'cpt_charge' => Input::get('cpt_charge'), 'reason' => Input::get('reason'), 'unit' => '1', 'payment' => '0', 'practice_id' => Session::get('practice_id')); if ($query) { DB::table('billing_core')->where('billing_core_id', '=', $id)->update($data); $this->audit('Update'); $result['message'] = 'Miscellaneous Bill Updated'; } else { $id1 = DB::table('billing_core')->insertGetId($data); $this->audit('Add'); $data1 = array('other_billing_id' => $id1); DB::table('billing_core')->where('billing_core_id', '=', $id1)->update($data1); $this->audit('Update'); $result['message'] = 'Miscellaneous Bill Added'; } echo json_encode($result); }