33 lines
898 B
PHP
33 lines
898 B
PHP
<?php
|
|
namespace App\Livewire\Admin;
|
|
|
|
use App\Models\Patient;
|
|
use Livewire\Component;
|
|
use Livewire\WithPagination;
|
|
|
|
class PatientHistory extends Component
|
|
{
|
|
use WithPagination;
|
|
|
|
public Patient $patient;
|
|
|
|
public function mount(Patient $patient)
|
|
{
|
|
// Load relasi user bawaan pasien
|
|
$this->patient = $patient->load('user');
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
// Mengambil data rekam medis pasien yang diurutkan dari pemeriksaan terbaru[cite: 4, 7]
|
|
$medicalRecords = $this->patient->medicalRecords()
|
|
->with(['doctor', 'appointment.serviceCategory']) // Load relasi dokter dan poli[cite: 3, 7]
|
|
->latest()
|
|
->paginate(5);
|
|
|
|
return view('livewire.admin.patient-history', [
|
|
'medicalRecords' => $medicalRecords, // Mengirim variabel medicalRecords ke view
|
|
])->layout('layouts.app');
|
|
}
|
|
}
|