コード例 #1
0
ファイル: Front.php プロジェクト: Bmax-Tech/SEP-Prototype_MVC
 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;
 }
コード例 #2
0
 public function GetCommentsOnDoctor()
 {
     $doc = json_decode($_COOKIE['doctor_user'], true);
     $doc_id = $doc[0]['doc_id'];
     // this should be replaced by $COOKIE reference
     try {
         $comments = Comments::whereDoctor_id($doc_id)->orderBy('id', 'DESC')->limit(20)->get();
         foreach ($comments as $com) {
             $pat = Patients::whereUser_id($com->user_id)->first();
             $img = Images::whereUser_id($pat->user_id)->first();
             $main_ob['com_data'] = $com;
             $main_ob['pat_first_name'] = $pat->first_name;
             $main_ob['pat_last_name'] = $pat->last_name;
             $main_ob['pat_img'] = $img->image_path;
             $res[] = $main_ob;
         }
     } catch (Exception $e) {
         $this->LogError('AjaxController Get Comments On Doctor Function', $e);
     }
     return response()->json($res);
 }
コード例 #3
0
 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);
 }