Meja Medis
Meja Pasien
Model Medis
public function patients() {
return $this->belongsTo(Patient::class);
}
Model Pasien
public function medicals() {
return $this->hasMany(Medical::class) ;
}
Pengendali Medis
public function index()
{
$medicals=Medical::all();
return view('main.medicalrecord.index',compact('medicals'));
}
rekam medis.indeks LIHAT
<table class="table table-striped table-hover table-condensed">
<thead>
<tr>
<th><strong>Patient No.</strong></th>//from the Patient table
<th><strong>First Name</strong></th>//from the Patient table
<th><strong>Middle Name</strong></th>//from the Patient table
<th><strong>Last Name</strong></th>//from the Patient table
<th><strong>Smoke</strong></th>//from the Medical table
</tr>
</thead>
<tbody>
@if($medicals)
@foreach($medicals as $medical)
<tr>
<td>{{$medical->patient_id}}</td>
<td></td>
</tr>
@endforeach
@endif
</tbody>
</table>
Hai Teman-teman, Saya menggunakan kunci asing yaitu $table-›foreign('patient_id')-›references('id')-›on('patients'); dalam migrasi medis.
Bagaimana cara mendapatkan data DB Pasien yaitu id, nama depan, nama tengah, nama belakang dan mengambil ke Tabel Medis di Tampilan saya singkatnya cara menggabungkan dua tabel yaitu tabel Pasien dan Tabel Medis dengan kunci asing