public function UpdateDoctorAccount(Request $request) { //dd($request); $doc = json_decode($_COOKIE['doctor_user'], true); $doctor_id = $doc[0]['doc_id']; // Holds Doctor ID $user_id = $doc[0]['id']; // Holds User ID try { /* Update Doctor details */ $doctor_ob = Doctors::find($doctor_id); //$doctor_ob->first_name = Input::get('first_name'); //$doctor_ob->last_name = Input::get('last_name'); $doctor_ob->dob = Input::get('dob'); $doctor_ob->nic = Input::get('nic'); $doctor_ob->address_1 = Input::get('address_1'); $doctor_ob->address_2 = Input::get('address_2'); $doctor_ob->city = Input::get('city'); $doctor_ob->district = Input::get('district'); $doctor_ob->contact_number = Input::get('contact_no'); $doctor_ob->email = Input::get('email'); $doctor_ob->description = Input::get('doc_description'); $doctor_ob->longitude = Input::get('longitude'); $doctor_ob->latitude = Input::get('latitude'); $doctor_ob->save(); /* Update Specialization Details */ $specialized_ob = Specialization::whereDoc_id($doctor_id)->first(); $specialized_ob->spec_1 = Input::get('specialized')[0]; $specialized_ob->spec_2 = Input::get('specialized')[1]; $specialized_ob->spec_3 = Input::get('specialized')[2]; $specialized_ob->spec_4 = Input::get('specialized')[3]; $specialized_ob->spec_5 = Input::get('specialized')[4]; $specialized_ob->save(); /* Update Treatment Details */ $treatment_ob = Treatments::whereDoc_id($doctor_id)->first(); $treatment_ob->treat_1 = Input::get('treatments')[0]; $treatment_ob->treat_2 = Input::get('treatments')[1]; $treatment_ob->treat_3 = Input::get('treatments')[2]; $treatment_ob->treat_4 = Input::get('treatments')[3]; $treatment_ob->treat_5 = Input::get('treatments')[4]; $treatment_ob->save(); /* Update Consultation Times Details */ $consult_ob = ConsultationTimes::whereDoc_id($doctor_id)->first(); $consult_ob->time_1 = Input::get('consult_times')[0]; $consult_ob->time_2 = Input::get('consult_times')[1]; $consult_ob->time_3 = Input::get('consult_times')[2]; $consult_ob->save(); /* Check Whether New Image Upload is Available or not */ if (isset(Input::file('profile_img')[0])) { /* This function will upload image */ self::upload_doctor_image($request, $user_id); /* Updates Database Images table Image_path with new path */ $img_ob = Images::whereUser_id($user_id)->first(); $img_ob->image_path = "profile_images/doctor_images/doc_profile_img_" . $user_id . ".png"; $img_ob->save(); } return Redirect::to('/DoctorAccount'); } catch (Exception $e) { $this->LogError('Update Doctor Account Function', $e); } }
public function get_comments_by_user(Request $request) { $user = json_decode($_COOKIE['user'], true); try { $comments = Comments::whereUser_id($user[0]['id'])->orderBy('id', 'DESC')->limit(20)->get(); foreach ($comments as $com) { $doc = Doctors::find($com->doctor_id); $img = Images::whereUser_id($doc->user_id)->first(); $main_ob['com_data'] = $com; $main_ob['doc_first_name'] = $doc->first_name; $main_ob['doc_last_name'] = $doc->last_name; $main_ob['doc_img'] = $img->image_path; $res[] = $main_ob; } } catch (Exception $e) { $this->LogError('AjaxController Get_Comments_By_User Function', $e); } return response()->json($res); }
public function view_profile($doc_name, $doc_id) { try { $doctor = Doctors::find($doc_id); $img = Images::where('user_id', $doctor->user_id)->first(); $main_doc_ob['image_data'] = $img; $main_doc_ob['doctor_data'] = $doctor; if ($doctor->doc_type == "FORMAL") { $main_doc_ob['doc_type'] = "FORMAL"; $formal = Formal_doctors::where('doctor_id', $doctor->id)->first(); $main_doc_ob['formal_data'] = $formal; } else { $main_doc_ob['doc_type'] = "NON_FORMAL"; $non_formal = Non_Formal_doctors::where('doctor_id', $doctor->id)->first(); $main_doc_ob['non_formal_data'] = $non_formal; } $spec = Specialization::where('doc_id', $doctor->id)->first(); $treat = Treatments::where('doc_id', $doctor->id)->first(); $main_doc_ob['spec_data'] = $spec; $main_doc_ob['treat_data'] = $treat; } catch (Exception $e) { $this->LogError('View Doctor Profile', $e); } return View::make('profile', array('doctor' => $main_doc_ob)); }