Skip to content
This repository has been archived by the owner on Jun 17, 2019. It is now read-only.

Commit

Permalink
Creating viewhospital function in hospital controller
Browse files Browse the repository at this point in the history
  • Loading branch information
FauzanAr committed Apr 14, 2019
1 parent de98fcb commit d4f586d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
16 changes: 15 additions & 1 deletion app/Http/Controllers/HospitalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function indexUser()
$data = [
'location' => $location,
];
return view ('SearchRS')->with('location',$location);
return view ('SearchRS')->with('data',$data);
}

public function searchHospital(Request $request)
Expand All @@ -215,4 +215,18 @@ public function searchHospital(Request $request)
];
return view ('listHospital')->with('data',$data);
}

public function viewHospital($id)
{
$hospital = Hospital::find($id);
$roomId = DB::table('room_details')->where('hospital_id',$hospital->id);
if (count($roomId)<=0){
$roomId = null;
}
$data = [
'hospital' => $hospital,
'roomId' => $roomId
];
return view ('viewhospital')->with('data',$data);
}
}
7 changes: 4 additions & 3 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@

Route::get('/searchrs', 'HospitalController@indexUser')->name('search.index.hospital');
Route::post('/searchrs/listhospital/cari', 'HospitalController@searchHospital')->name('search.hospital');
Route::get('/viewhospital', function() {
return view('viewhospital');
});
Route::get('/searchrs/listhospital/viewhospital/{id}', 'HospitalController@viewHospital')->name('view.hospital');

Route::get('/viewhospital', function () {
return view ('viewhospital');
});
Route::get('/lihatsemuars', function() {
return view('LSRumahSakit');
});
Expand Down

0 comments on commit d4f586d

Please sign in to comment.