public function UpdateDoctorCheck(Request $request)
 {
     $type = Input::get('type');
     $data = Input::get('data');
     try {
         if ($type == 'username') {
             /* Check for username is taken or not */
             $patients = User::whereEmail($data)->first();
         } else {
             if ($type == 'email') {
                 /* Check for email is taken or not */
                 $patients = Doctors::whereEmail($data)->first();
             }
         }
     } catch (Exception $e) {
         $this->LogError('AjaxController UpdateDoctorCheck Function', $e);
     }
     if (isset($patients)) {
         $res['msg'] = "USING";
     } else {
         $res['msg'] = "NOTHING";
     }
     return response()->json($res);
 }
示例#2
0
 public function get_community_suggestions()
 {
     try {
         $com_sug = Doctors::whereDoc_type('NON_FORMAL')->orderBy('id', 'DESC')->limit(5)->get();
         foreach ($com_sug as $doc) {
             $temp['doc_id'] = $doc->id;
             $temp['doc_first_name'] = $doc->first_name;
             $temp['doc_last_name'] = $doc->last_name;
             $temp['doc_address_2'] = $doc->address_2;
             $temp['doc_city'] = $doc->city;
             /* Get suggested User */
             $non_formal = Non_Formal_doctors::whereDoctor_id($doc->id)->first();
             $user = User::whereId($non_formal->suggested_user)->first();
             $temp['sug_user_name'] = $user->name;
             /* Get suggested User Image */
             $img = Images::whereUser_id($user->id)->first();
             $temp['image_path'] = $img->image_path;
             $featured_main[] = $temp;
         }
     } catch (Exception $e) {
         $this->LogError('Get Community Suggestion Doctors Function', $e);
     }
     return $featured_main;
 }
 public function removeComment(Request $request, $user_id)
 {
     try {
         //get the comment details for given id
         $user = DB::table('comments')->where('id', $user_id)->first();
         $doctor_id = $user->doctor_id;
         //get the doctor id
         $rating = $user->rating;
         //gat the rating
         //take the doctor id and reduce rating
         $doc = Doctors::whereId($doctor_id)->first();
         $rateCount = $doc->tot_stars;
         //get total stars rated
         $rateCount = (int) $rateCount - (int) $rating;
         // substract the deleting rating
         $rateUserCount = $doc->rated_tot_users;
         // Get total no of ratings
         $rateUserCount = (int) $rateUserCount - 1;
         $doc->tot_stars = $rateCount;
         $doc->rated_tot_users = $rateUserCount;
         $doc->save();
         $uid = $user->user_id;
         //get the user id
         $user1 = DB::table('patients')->where('user_id', $uid)->first();
         //get user details for the given user id
         $count = $user1->spam_count;
         //get the spam massage count
         $count = $count + 1;
         //spam count column increase by 1
         DB::table('patients')->where('user_id', $uid)->update(['spam_count' => $count]);
         //add new spam count to the user
         if ($count >= 5) {
             //check whether spam count is exeed the given limet
             DB::table('users')->where('id', $uid)->update(['mode' => 0]);
             //block the user // 0=block  //1=unblock
         }
         //remove the comment
         DB::table('comments')->where('id', $user_id)->delete();
         $HTMLView = (string) view('admin_patients_views.home_2');
         $res['page'] = $HTMLView;
         $res['error'] = false;
         return response()->json($res);
     } catch (Exception $e) {
         $HTMLView = (string) view('errors.adminError');
         $res['page'] = $HTMLView;
         $res['error'] = true;
         return response()->json($res);
     }
 }
 public function updatefet(Request $request, $count, $doc_id)
 {
     /* $update = Featured_doc::whereFid($count)->get();
         $update->did =$doc_id;
        $update->save();*/
     DB::table('featured_doc')->where('fid', $count)->update(['did' => $doc_id]);
     $featured_doc = DB::table('featured_doc')->join('doctors', 'featured_doc.did', '=', 'doctors.id')->orderBy('fid', 'asc')->get();
     //$fetured_doc = Featured_doc::all();
     $reg_doc = Doctors::all();
     $HTMLView = (string) view('costomize_home_views.home12')->with(['featured_doc1' => $featured_doc, 'reg_doctor' => $reg_doc]);
     $res['com_data'] = $HTMLView;
     return response()->json($res);
 }
 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);
 }