Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
0
 public function graph1Count()
 {
     try {
         //get the count af users accordig to registered dates
         $graph1 = DB::select(DB::raw('SELECT DATE(reg_date) AS y,COUNT(*) AS item1 FROM patients GROUP BY DATE(reg_date)'));
         //get the count af doctors accordig to registered dates
         $graph2 = DB::select(DB::raw('SELECT DATE(reg_date) AS y,COUNT(*) AS item1 FROM doctors GROUP BY DATE(reg_date)'));
         //get the count af doctors accordig to registered dates and doctor types
         $graph3 = DB::select(DB::raw('SELECT DATE(reg_date) AS y ,SUM(CASE WHEN doc_type = "FORMAL" THEN 1 ELSE 0 END) AS item1, SUM(CASE WHEN doc_type = "NON_FORMAL" THEN 1 ELSE 0 END) AS item2    FROM doctors  GROUP BY DATE(reg_date)'));
         //get all user count
         $Patients = Patients::all();
         //Get formal doctor count
         $Formal_doctors = Formal_doctors::all();
         //Get non formal doctor count
         $Non_Formal_doctors = Non_Formal_doctors::all();
         //get the number of results in each quary result
         $graph41 = sizeof($Patients);
         $graph42 = sizeof($Formal_doctors);
         $graph43 = sizeof($Non_Formal_doctors);
         //pass the values through json
         $res['graph_1'] = $graph1;
         $res['graph_2'] = $graph2;
         $res['graph_3'] = $graph3;
         $res['graph_41'] = $graph41;
         $res['graph_42'] = $graph42;
         $res['graph_43'] = $graph43;
     } catch (Exception $e) {
         $this->LogError('AdminController Register_Page Function', $e);
     }
     return response()->json($res);
 }