public function getAppointmentDoctor(Request $request) { if (!Patient::isPatient() && !HospitalEmployee::isDoctor() && !HospitalEmployee::isStaff()) { return response()->json(["success" => false, "error" => 'notlogin or notvalid']); } $emp_id = $request->input('emp_id'); return response()->json(["success" => true, "data" => Appointment::getAppointmentDoctor($emp_id)]); }
public static function getUserAppointment(User $user) { if ($user->userable->role == 'Doctor') { $appointments = Appointment::getAppointmentDoctor($user->userable->emp_id); } else { if ($user->userable->role == null) { $appointments = Appointment::getAppointmentPatient($user->userable->id); } else { $appointments = null; } } return $appointments; }