Esempio n. 1
0
 public function adminSection()
 {
     $adminId = Session::get('admin_id');
     if (!isset($adminId)) {
         return Redirect::to('/');
     }
     $expertCount = Expert::where('status', '=', 'active')->count();
     $patientCount = Patient::where('status', '=', 'active')->count();
     return View::make('admin.admin-section')->with('expertCount', $expertCount)->with('patientCount', $patientCount);
 }
 function dataInstituteExperts($id)
 {
     if (isset($id)) {
         $experts = Expert::where('institute_id', '=', $id)->get();
     } else {
         $institute_id = Session::get('institute_id');
         if (!isset($institute_id)) {
             return 'not logged';
         }
         $experts = Expert::where('institute_id', '=', $institute_id)->get();
     }
     if (isset($experts)) {
         return json_encode(array('message' => 'found', 'experts' => $experts));
     } else {
         return json_encode(array('message' => 'empty'));
     }
 }
 public function sendExpertPassword()
 {
     $email = Input::get('email');
     $expert = Expert::where('Expert.email', '=', $email)->first();
     $data = array('name' => $expert->name);
     Mail::send('emails.expert-reset-password', $data, function ($message) use($expert) {
         $message->to($expert->email, $expert->name)->subject('You requested your password');
     });
 }
Esempio n. 4
0
 public function searchByKeyword($key, $cityId = null)
 {
     if (isset($key)) {
         if (isset($cityId)) {
             $experts = Expert::where('first_name', 'like', '%' . $key . '%')->Orwhere('last_name', 'like', '%' . $key . '%')->where('status', '=', 'active')->get();
             $institutes = Institute::where('name', 'like', '%' . $key . '%')->where('status', '=', 'active')->get();
         } else {
             $experts = Expert::where('first_name', 'like', '%' . $key . '%')->Orwhere('last_name', 'like', '%' . $key . '%')->where('status', '=', 'active')->get();
             $institutes = Institute::where('name', 'like', '%' . $key . '%')->where('status', '=', 'active')->get();
         }
         $data = array();
         if (isset($experts) && count($experts) > 0) {
             foreach ($experts as $expert) {
                 $data[] = array('id' => $expert->id, 'name' => $expert->first_name . ' ' . $expert->last_name, 'group' => 'Experts');
             }
         }
         if (isset($institutes) && count($institutes) > 0) {
             foreach ($institutes as $institute) {
                 $data[] = array('id' => $institute->id, 'name' => $institute->name, 'group' => 'Institutes');
             }
         }
         if (isset($data) && count($data) > 0) {
             return json_encode(array('message' => 'found', 'data' => $data));
         } else {
             return json_encode(array('message' => 'empty'));
         }
     } else {
         return json_encode(array('message' => 'invalid'));
     }
 }