- Joined
- Oct 16, 2016
- Posts
- 243
- Solutions
- 1
- Reaction
- 259
- Points
- 188
hello po kumuha po ako ng side project thesis system po kaso dito po sa part na to yung error
ito po yung connection sa web.php
Route::controller(PatientController::class)->prefix('patients')->group(function () {
Route::get('index/{room}', 'showCurrentAdmit')->name('patients.show');
});
and then ito po yung controller
public function showCurrentAdmit($room)
{
$patients = Patient::where('room', $room)->get();
return view('patients.index', compact('patients', 'room'));
}
ito naman po yung sa html
<tbody>
@if($patient->count() > 0)
@foreach ($patient as $rs)
@if($rs->room == $room)
<tr>
<td class="align-middle">{{ $loop->iteration }}</td>
<td class="align-middle">{{ $rs-> name }}</td>
<td class="align-middle">{{ $rs-> age }}</td>
<td class="align-middle">{{ $rs-> gender }}</td>
<td class="align-middle">{{ $rs-> Birthday }}</td>
<td class="align-middle">{{ $rs-> Address }}</td>
<td class="align-middle">{{ $rs-> Contact }}</td>
<td class="align-middle">{{ $rs-> Guardian }}</td>
<td class="align-middle">{{ $rs-> room }}</td>
<td class="align-middle">
<div class="btn-group" role="group" aria-label="Basic example">
<form method="POST" action="{{ route('patients.discharge', $rs->id) }}">
@csrf
<button type="submit">Discharge</button>
</form>
</td>
</tr>
@endif
@endforeach
@endif
</tbody>
pero ang error po na lumalabas ay Undefined variable $room gusto kopo sana gawin ay may 14 rooms then every rooms po ay 1 lang ang capacity pag nalagyan na ng data yung isang room halimbawa ay room 1 yung room na to ay occupied na maraming salamat po
ito po yung connection sa web.php
Route::controller(PatientController::class)->prefix('patients')->group(function () {
Route::get('index/{room}', 'showCurrentAdmit')->name('patients.show');
});
and then ito po yung controller
public function showCurrentAdmit($room)
{
$patients = Patient::where('room', $room)->get();
return view('patients.index', compact('patients', 'room'));
}
ito naman po yung sa html
<tbody>
@if($patient->count() > 0)
@foreach ($patient as $rs)
@if($rs->room == $room)
<tr>
<td class="align-middle">{{ $loop->iteration }}</td>
<td class="align-middle">{{ $rs-> name }}</td>
<td class="align-middle">{{ $rs-> age }}</td>
<td class="align-middle">{{ $rs-> gender }}</td>
<td class="align-middle">{{ $rs-> Birthday }}</td>
<td class="align-middle">{{ $rs-> Address }}</td>
<td class="align-middle">{{ $rs-> Contact }}</td>
<td class="align-middle">{{ $rs-> Guardian }}</td>
<td class="align-middle">{{ $rs-> room }}</td>
<td class="align-middle">
<div class="btn-group" role="group" aria-label="Basic example">
<form method="POST" action="{{ route('patients.discharge', $rs->id) }}">
@csrf
<button type="submit">Discharge</button>
</form>
</td>
</tr>
@endif
@endforeach
@endif
</tbody>
pero ang error po na lumalabas ay Undefined variable $room gusto kopo sana gawin ay may 14 rooms then every rooms po ay 1 lang ang capacity pag nalagyan na ng data yung isang room halimbawa ay room 1 yung room na to ay occupied na maraming salamat po