Example #1
0
 public function changeStatus($new_status)
 {
     $new_status_type = AppointmentStatus::findOrFail($new_status);
     $this->patient->addHistoryItem("Appointment Status Changed", "The appointment on " . $this->start_date->format('d/m/Y') . " at " . $this->start_date->format('H:i') . " with <a href='" . url('user/' . $this->dentist->id) . "'>" . $this->dentist->first_name . " " . $this->dentist->last_name . "</a> has been changed from '" . $this->status->name . "' to '" . $new_status_type->name . "'", Auth::user()->id, 10);
     $this->status_id = $new_status;
     $this->save();
     if ($new_status == 3) {
         $this->arrival_time = Carbon::now()->format('Y-m-d H:i:s');
     }
     if ($new_status == 5) {
         Appointment::incrementCompletedAppointmentStats();
     }
     if ($new_status == 6) {
         Appointment::incrementFTAAppointmentStats();
     }
 }