function sendMessageToPhone($collapseKey, $messageText, $username)
 {
     //llamar al usuario
     $user = new users();
     $data = $user->getUser($username);
     if ($data != false) {
         $apiKey = 'AIzaSyBxy1d7BwmTE1Wcy1PyucThSBPVKDhdeow⁠⁠⁠⁠';
         $userIdentificador = $data["reg_id"];
         $headers = array('Authorization:key=' . $apiKey);
         $data = array('registration_ids' => $userIdentificador, 'collapse_key' => $collapseKey, 'data.message' => $messageText);
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, "https://android.googleapis.com/gcm/send");
         if ($headers) {
             curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
         }
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($ch, CURLOPT_POST, true);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
         $response = curl_exec($ch);
         $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
         if (curl_errno($ch)) {
             return 'fail';
         }
         if ($httpCode != 200) {
             return 'status code 200';
         }
         curl_close($ch);
         return $response;
     } else {
         return 'No existe el usuario';
     }
 }
예제 #2
0
 public function createUser(RegisterRequest $request)
 {
     if (Auth::user()->guest) {
         $user = User::create(['name' => $request['name'], 'email' => $request['email'], 'password' => bcrypt($request['password']), 'birthday' => $request['birthday'], 'admin' => false]);
         $user->parent()->associate(users::where('email', '=', $request['parentEmail']));
         $user->save();
     } else {
         return view('users.edit');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(users $users)
 {
     $users->delete();
     return Redirect::route('users.index')->with('message', 'User deleted.');
 }
예제 #4
0
 public function showPrescription(Request $request)
 {
     $userId = $request['userId'];
     $prescription = users::where('userId', $userId)->join('appointment', 'users.userId', '=', 'appointment.patientId')->join('prescription', 'appointment.appointmentId', '=', 'prescription.appointmentId')->last();
     //return view('pharmacist.recordPrescriptionHistory',compact('prescription'));
 }
예제 #5
0
 public function createAppointmentStaff($userId)
 {
     $patient = users::where('userId', $userId)->first();
     return view('staff.createAppointmentForPatient2')->with('patient', $patient);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     // ambil semua data pegawai
     $users = users::latest('created_at')->get();
     return view('siswa.siswa', compact('users'));
 }