Exemplo n.º 1
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);
 }