Add Additional Information
This commit is contained in:
@@ -18,7 +18,7 @@ class AppointmentController extends Controller
|
||||
public function index()
|
||||
{
|
||||
$appointments = Appointment::query()
|
||||
->with('doctor.user', 'doctor.speciality', 'appointmentDetail', 'healthCare')
|
||||
->with('doctor.user', 'doctor.speciality', 'appointmentDetail', 'healthCare', 'user')
|
||||
->latest()
|
||||
->paginate(15);
|
||||
return response()->json(Helper::paginateResources(AppointmentResource::collection($appointments)));
|
||||
|
||||
@@ -17,7 +17,8 @@ class AppointmentResource extends JsonResource
|
||||
{
|
||||
$appointment = [
|
||||
'id' => $this->nID,
|
||||
'doctor_name' => isset($this->doctor->user->sFirstName) ? $this->doctor->user->sFirstName . ' ' . $this->doctor->user->sLastName : null,
|
||||
'patient_name' => $this->user ? $this->user->full_name : '',
|
||||
'doctor_name' => $this->doctor ? $this->doctor->user?->full_name : '',
|
||||
'speciality' => $this->doctor->speciality->sKeterangan,
|
||||
'date_appointment' => Carbon::parse($this->appointmentDetail->dTanggalAppointment)->format('d-m-Y') . ' ' . $this->appointmentDetail->tTimeAppointment,
|
||||
'date_created' => Carbon::parse($this->dCreateOn)->format('d-m-Y H:i:s') ?? null,
|
||||
@@ -25,6 +26,12 @@ class AppointmentResource extends JsonResource
|
||||
'status' => $this->status_name,
|
||||
'health_care' => $this->healthCare->sHealthCare ?? null,
|
||||
'payment_method' => $this->payment_method ?? null,
|
||||
'patient' => $this->user,
|
||||
'booking_code' => $this->sBookingCode,
|
||||
'his_detail' => [
|
||||
'RegID' => $this->sRegID,
|
||||
'Medrec' => $this->sNomorRekamMedis
|
||||
]
|
||||
];
|
||||
|
||||
$payment_detail = null;
|
||||
|
||||
Reference in New Issue
Block a user