/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // $province_id = Input::get('province_id'); $city_id = Input::get('city_id'); $specialization_id = Input::get('specialization_id'); $verified = Input::get('verified'); $data = array(); if (empty($province_id) && empty($city_id) && empty($specialization_id) && empty($verified)) { //menampilkan semua gender $data['content'] = \App\Doctor::all(); $data['province_id'] = null; $data['city_id'] = null; $data['specialization_id'] = null; $data['verified'] = null; } else { $data['content'] = $data['province_id'] = $province_id; $data['city_id'] = $city_id; $data['specialization_id'] = $specialization_id; $data['verified'] = $verified; } $data['list_province'] = \App\Province::lists('name', 'id'); $data['list_city'] = \App\City::lists('name', 'id'); $data['list_specialization'] = \App\Specialization::lists('name', 'id'); return view('pages.admin.clinic.doctor.index')->with('data', $data); }
public function edit($id) { $data = []; $data['article'] = ArticleCategory::with('articles')->get(); $data['content'] = \App\Doctor::find($id); $data['list_province'] = \App\Province::lists('name', 'id'); $data['list_city'] = \App\City::lists('name', 'id'); $data['list_specialization'] = \App\Specialization::lists('name', 'id'); $data['days'] = \App\Day::lists('name', 'id'); return view('frontend.pages.clinic.doctor-edit', compact('data')); }
/** * Run the database seeds. * * @return void */ public function run() { \App\SpecializationCategory::create(['name' => 'Anak']); \App\SpecializationCategory::create(['name' => 'Gigi']); \App\SpecializationCategory::create(['name' => 'Jantung']); \App\Specialization::create(['name' => 'Anak (Jantung)', 'specialization_category_id' => '1']); \App\Specialization::create(['name' => 'Anak (Kulit)', 'specialization_category_id' => '1']); \App\Specialization::create(['name' => 'Bedah Mulut', 'specialization_category_id' => '2']); \App\Specialization::create(['name' => 'Penyakit Gigi', 'specialization_category_id' => '2']); \App\Specialization::create(['name' => 'Psikiatri Remaja', 'specialization_category_id' => '3']); }
public function search(Request $request) { $data = array(); $data['days'] = \App\Day::lists('name', 'id'); $data['article'] = ArticleCategory::with('articles')->get(); $data['city'] = \App\City::all(); $data['specialization'] = \App\Specialization::all(); $data['city_k'] = urldecode($request->input('city')); $data['specialization_k'] = urldecode($request->input('specialization')); $data['keyword'] = urldecode($request->input('keyword')); $data['gender_k'] = $request->input('gender'); $data['practice_day_k'] = $request->input('practice_day'); $data['city_obj'] = \App\City::where('name', 'like', '%' . $data['city_k'] . '%')->lists('id'); $arr_specialization = \App\Specialization::where('name', 'like', '%' . $data['specialization_k'] . '%')->lists('id'); /*$result = \App\Specialization::where('name','like','%'.$data['specialization_k'].'%') ->whereHas('doctors', function($query) use($data){ $query->whereIn('city_id', $data['city_obj']) ->where('name','like', '%'.$data['keyword'].'%') ->whereHas('day', function($query) use($data){ if(!empty($data['practice_day_k']) > 0) $query->whereIn('days.id', $data['practice_day_k']); }) ; if(!empty($data['gender_k'])){ $query->where('gender',$data['gender_k']); } })-> with('doctors')->get();*/ $result = \App\Doctor::whereIn('city_id', $data['city_obj'])->where('name', 'like', '%' . $data['keyword'] . '%')->whereHas('day', function ($query) use($data) { if (!empty($data['practice_day_k']) > 0) { $query->whereIn('days.id', $data['practice_day_k']); } }); if (!empty($data['gender_k'])) { $result->where('gender', $data['gender_k']); } $result = $result->paginate(10); $data['article'] = ArticleCategory::with('articles')->get(); $data['content'] = $result; return view('frontend.pages.home.search-result', compact('data')); }
public function register() { // $data = array(); $data['content'] = null; $data['list_gender'][0] = 'L'; $data['list_gender'][1] = 'P'; $data['city'] = \App\City::all(); $data['specialization'] = \App\Specialization::all(); $data['article'] = \App\ArticleCategory::with('articles')->get(); return view('frontend.pages.clinic.register')->with('data', $data); }
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 getDoctorsInfoList(Request $request) { if (Auth::check()) { /* * Добавление врача в БД */ if ($request->has("add_doctor")) { $newDoc = new Doctor(); $newDoc->name = $request->input("new_doctor_name"); $newDoc->spec_id = $request->input("new_spec_id"); $newDoc->save(); } /* * Удаление врача из БД */ if ($request->has("del_doctor")) { $delDoc = Doctor::find($request->input("del_doctor_id")); $delDoc->delete(); } /* * Добавление специализации в БД */ if ($request->has("add_spec")) { $newSpec = new Specialization(); $newSpec->name = $request->input("new_spec_name"); //echo "true"; //exit; $newSpec->save(); } /* * Удаление специализации из БД */ if ($request->has("del_spec")) { /*echo "id"; echo $request->input("spec_list"); exit;*/ $delSpec = Specialization::find($request->input("spec_list")); $delSpec->delete(); } //$doctors = Doctor::paginate(15); $doctors = Doctor::paginate(15); $spec = Specialization::all(); $user = Auth::user(); $data["user_id"] = $user->id; $data["user_fullname"] = $user->fullname; /* foreach ($doctors as $doc){ print_r($doc->spec); }*/ //print_r($doctors); //exit; return view("doctors-list", ["doctors" => $doctors, "spec" => $spec, "data" => $data]); } }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // $province_id = Input::get('province_id'); $city_id = Input::get('city_id'); $specialization_id = Input::get('specialization_id'); $verified = Input::get('verified'); $data = array(); $data['content'] = \App\Clinic::find($id); if (empty($province_id) && empty($city_id) && empty($specialization_id) && empty($verified)) { $data['content_doctor'] = \App\Doctor::whereHas('doctor_clinic', function ($q) use($id) { $q->where('clinic_id', $id); })->get(); $data['province_id'] = null; $data['city_id'] = null; $data['specialization_id'] = null; $data['verified'] = null; } else { $data['content_doctor'] = \App\Doctor::where('city_id', $city_id)->where('specialization_id', $specialization_id)->where('verified', $verified)->whereHas('doctor_clinic', function ($q) use($id) { $q - $q->where('clinic_id', $id); })->get(); $data['province_id'] = $province_id; $data['city_id'] = $city_id; $data['specialization_id'] = $specialization_id; $data['verified'] = $verified; } $data['list_province'] = \App\Province::lists('name', 'id'); $data['list_city'] = \App\City::lists('name', 'id'); $data['list_specialization'] = \App\Specialization::lists('name', 'id'); return view('pages.admin.clinic.show', compact('data')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // $spec = Specialization::find($id); $spec->delete(); Session::flash('success', "Spesialisasi berhasil dihapus!"); return redirect()->route('admin.spec.index'); }
public function add_doctor_save(Request $request) { $time_stamp = time(); try { /* First -> Create Users Record */ User::create(['name' => Input::get('first_name'), 'email' => $time_stamp, 'password' => md5($time_stamp)]); $user = User::whereEmail($time_stamp)->wherePassword(md5($time_stamp))->first(); /* Second -> Images Record */ Images::create(['user_id' => $user->id, 'image_path' => 'profile_images/default_user_icon.png']); /* Third -> Doctor Object Is Created */ Doctors::create(['user_id' => $user->id, 'doc_type' => 'NON_FORMAL', 'first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name'), 'gender' => Input::get('gender'), 'dob' => '-', 'nic' => '-', 'address_1' => Input::get('address_1'), 'address_2' => Input::get('address_2'), 'city' => Input::get('city'), 'district' => Input::get('district'), 'contact_number' => Input::get('contact_number'), 'email' => Input::get('email'), 'description' => Input::get('doc_description'), 'rating' => 0, 'tot_stars' => 0, 'rated_tot_users' => 0, 'reg_date' => new \DateTime()]); $doc_ob = Doctors::whereUser_id($user->id)->first(); /* Fourth -> add Non Formal Doctors */ $user_cookie = json_decode($_COOKIE['user'], true); Non_Formal_doctors::create(['doctor_id' => $doc_ob->id, 'suggested_user' => $user_cookie[0]['id']]); /* Fifth -> Create Specialization */ Specialization::create(['doc_id' => $doc_ob->id, 'spec_1' => Input::get('specialized')[0], 'spec_2' => Input::get('specialized')[1], 'spec_3' => Input::get('specialized')[2], 'spec_4' => Input::get('specialized')[3], 'spec_5' => Input::get('specialized')[4]]); /* Sixth -> Create Treatments */ Treatments::create(['doc_id' => $doc_ob->id, 'treat_1' => Input::get('treatments')[0], 'treat_2' => Input::get('treatments')[1], 'treat_3' => Input::get('treatments')[2], 'treat_4' => Input::get('treatments')[3], 'treat_5' => Input::get('treatments')[4]]); } catch (Exception $e) { $this->LogError('Non Formal Doctor Create Function', $e); } return Redirect::to('/adddoctor'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { // $data = array(); $data['content'] = \App\Doctor::find($id); $data['list_province'] = \App\Province::lists('name', 'id'); $data['list_city'] = \App\City::lists('name', 'id'); $data['list_specialization'] = \App\Specialization::lists('name', 'id'); $data['days'] = \App\Day::lists('name', 'id'); return view('pages.admin.doctor.edit')->with('data', $data); }