public function anySendMenssage()
 {
     $mgs = Input::get('mgs');
     $doctor = Input::get('doctor');
     $appointment = Input::get('appointment');
     return Helpers::sendMenssage($doctor, $appointment, $mgs);
 }
 public function getCities3()
 {
     $country = Input::get('country');
     $id = Input::get('id');
     $load = Input::get('load');
     return Helpers::citiesAddress3($id, $load, $country);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //
     $p = Patient::find($id);
     if ($p) {
         return Helpers::Show($p);
     } else {
         return Helpers::Mgs("Error {$id} Incorrecto");
     }
 }
 public function showMyAppointments()
 {
     $date = Input::get('date');
     $doctor = Input::get('doctor');
     $bussines = Input::get('bussines');
     return Helpers::appointmentTimes($date, $doctor, $bussines);
 }
Exemple #5
0
 public static function sendMenssage($doctor, $appoments, $mensage)
 {
     $mgs = new MgsAppointment();
     $mgs->title = "Message";
     $mgs->appointment_id = $appoments;
     $mgs->text = $mensage;
     $mgs->save();
     return Helpers::Mgs('Mensaje Send Ok');
 }
 public function createClinic()
 {
     //
     $first_name = Input::get('first_name');
     $last_name = Input::get('last_name');
     $email = Input::get('email');
     $date = Input::get('date');
     $username = Input::get('username');
     $phone = Input::get('phone');
     $insurance = Input::get('insurance');
     $country = Input::get('country');
     $city = Input::get('city');
     $clave = Input::get('pass');
     $id = Input::get('id');
     $dni = Input::get('dni');
     $my_address = Input::get('my_address');
     $lang = Input::get('lang');
     $base_64_picure = Input::get('picture');
     list($type, $base_64_picure) = explode(';', $base_64_picure);
     list(, $base_64_picure) = explode(',', $base_64_picure);
     $base_64_picure = base64_decode($base_64_picure);
     try {
         // Create the user
         $user = Sentry::getUserProvider()->create(array('email' => $email, 'password' => $clave, 'first_name' => $first_name, 'last_name' => $last_name, 'username' => $username, 'activated' => 1, 'gcm_id' => $id, 'dni' => $dni));
         $pa = new Patient();
         $pa->user_id = $user->id;
         $pa->insurance_id = $insurance;
         $pa->save();
         $str_random = str_random(10);
         $name_picture = '/assets/patient/images/profile_pic/' . $pa->id . '-' . $str_random . '.png';
         $al = public_path() . '/assets/patient/images/profile_pic/' . $pa->id . '-' . $str_random . '.png';
         file_put_contents($al, $base_64_picure);
         $address = new Address();
         $address->city_id = $city;
         $address->my_address = $my_address;
         $address->save();
         $profile = new Profile();
         $profile->lang = $lang;
         $profile->user_id = $user->id;
         $profile->address_id = $address->id;
         $profile->picture = $name_picture;
         $profile->phone = $phone;
         $profile->date = $date;
         $profile->save();
         // Find the group using the group id
         $adminGroup = Sentry::findGroupById(1);
         // Assign the group to the user
         $user->addGroup($adminGroup);
         $mgs = array('txt' => 'Success registration');
         return Helpers::Mgs($mgs);
     } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
         return Helpers::Mgs("Login field is required.");
     } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
         return Helpers::Mgs('Password field is required.');
     } catch (Cartalyst\Sentry\Users\UserExistsException $e) {
         return Helpers::Mgs('User with this login already exists.');
     } catch (Cartalyst\Sentry\Groups\GroupNotFoundException $e) {
         return Helpers::Mgs('Group was not found.');
     }
 }
Exemple #7
0
Route::resource('sessions', 'SessionsController', ['only' => ['create', 'store', 'destroy']]);
Route::get('test', function () {
    $in_start = date('Y-m-d', Input::get('start'));
    $date = $in_start;
    $states = array('confirmed', 'delayed', 'pending', 'in-progress', 'served', 'old');
    $appointment = Appointment::where('day', $date)->whereIn('state', $states)->get();
    dd(count($appointment));
});
# Solo Pacientes Pacientes
Route::group(['before' => 'auth|standardUser'], function () {
    Route::get('userProtected', 'StandardUserController@getUserProtected');
    Route::resource('profiles', 'UsersController', ['only' => ['show', 'edit', 'update']]);
});
# Solo Admin
Route::group(['prefix' => '/admin', 'before' => 'auth|admin'], function () {
    Route::get('/', ['as' => 'admin_dashboard', 'uses' => 'AdminController@getHome']);
    Route::get('/clinic', ['as' => 'admin_patient', 'uses' => 'AdminController@getClinic']);
    Route::resource('profiles', 'AdminUsersController', ['only' => ['index', 'show', 'edit', 'update', 'destroy']]);
    Route::get('/send', ['as' => 'admin_send', 'uses' => 'GcmController@send']);
});
App::missing(function ($exception) {
    if (Request::is('api/*')) {
        return H::Mgs("Url Not Access");
    } else {
        return Response::view('errors.missing', array(), 404);
    }
});
/*
 https://laracasts.com/lessons/caching-essentials
http://104.236.201.9/agendaMedica/api/appointment
*/
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  *
  */
 public function store()
 {
     $bussines_id = Input::get('bussines');
     $patient_id = Input::get('patient_id');
     $day = Input::get('day');
     $reason = Input::get('reason');
     $start_day = $day . " " . Input::get('start_date');
     $end_day = $day . " " . Input::get('end_date');
     $buss = Business::find($bussines_id);
     $agenda_id = $buss->agenda_id;
     $doctor_id = $buss->doctor_id;
     $agenda = Agenda::find($agenda_id);
     $patient_doctor = DoctorPatient::where('patient_id', $patient_id)->where('doctor_id', $doctor_id)->first();
     if (!$patient_doctor) {
         $add = new DoctorPatient();
         $add->patient_id = $patient_id;
         $add->doctor_id = $doctor_id;
         $add->save();
     }
     $cita = new Appointment();
     $cita->patient_id = $patient_id;
     $cita->agenda_id = $agenda_id;
     $cita->day = $day;
     $cita->start_date = $start_day;
     $cita->last_time = $start_day;
     $cita->end_date = $end_day;
     $cita->reason = $reason;
     if ($agenda->appointment_state) {
         $state = true;
         $cita->state = 'pending';
     } else {
         $state = false;
         $cita->state = 'confirmed';
     }
     $cita->save();
     if ($cita) {
         $mgs = array('txt' => 'Success Appointment', 'state' => $state);
         return Helpers::Mgs($mgs);
     } else {
         $mgs = array('txt' => 'Error Save');
         return Helpers::Mgs($mgs);
     }
 }