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 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); } /* Run Recently Viewed Profiles */ self::RecentlyViewedProfiles($doc_id); /* Add new hit to Profile View hit counter */ self::ProfileViewHitCounter($doc_id); return View::make('profile', array('doctor' => $main_doc_ob)); }