Example #1
0
 public function schedule($date, $start, $end)
 {
     $start_date = Carbon::createFromFormat("d-m-Y", $date);
     $start_time = explode(":", $start);
     $start_date->hour = $start_time[0];
     $start_date->minute = $start_time[1];
     $end_date = Carbon::createFromFormat("d-m-Y", $date);
     $end_time = explode(":", $end);
     $end_date->hour = $end_time[0];
     $end_date->minute = $end_time[1];
     if (Appointment::checkClashingAppointment($this->dentist->id, $start_date, $end_date)) {
         die('An error has occured. This appointment clashes with another. Please try again.');
     }
     $this->start_date = $start_date;
     $this->end_date = $end_date;
     $this->booked = 1;
     Appointment::incrementBookingStats();
     $this->save();
 }