diff --git a/app/Http/Controllers/RuanganController.php b/app/Http/Controllers/RuanganController.php index bbac8f8..7e7f061 100644 --- a/app/Http/Controllers/RuanganController.php +++ b/app/Http/Controllers/RuanganController.php @@ -2,63 +2,42 @@ namespace App\Http\Controllers; +use App\Models\Ruangan; use Illuminate\Http\Request; class RuanganController extends Controller { - /** - * Display a listing of the resource. - */ public function index() { - // + $ruangPelayanans = Ruangan::orderBy('nama_ruang_pelayanan')->paginate(10); + return view('ruangan', compact('ruangPelayanans')); } - /** - * Show the form for creating a new resource. - */ - public function create() - { - // - } - - /** - * Store a newly created resource in storage. - */ public function store(Request $request) { - // + $request->validate([ + 'nama_ruang_pelayanan' => 'required|string|min:3|max:100|unique:ruang_pelayanan,nama_ruang_pelayanan' + ]); + + Ruangan::create($request->all()); + return redirect()->route('ruangan.index')->with('success', 'Ruang pelayanan berhasil ditambahkan'); } - /** - * Display the specified resource. - */ - public function show(string $id) + public function update(Request $request, $id) { - // + $request->validate([ + 'nama_ruang_pelayanan' => 'required|string|min:3|max:100|unique:ruang_pelayanan,nama_ruang_pelayanan,'.$id.',id_ruang_pelayanan' + ]); + + $ruangPelayanan = Ruangan::findOrFail($id); + $ruangPelayanan->update($request->all()); + return redirect()->route('ruangan.index')->with('success', 'Ruang pelayanan berhasil diperbarui'); } - /** - * Show the form for editing the specified resource. - */ - public function edit(string $id) + public function destroy($id) { - // + $ruangPelayanan = Ruangan::findOrFail($id); + $ruangPelayanan->delete(); + return redirect()->route('ruangan.index')->with('success', 'Ruang pelayanan berhasil dihapus'); } - - /** - * Update the specified resource in storage. - */ - public function update(Request $request, string $id) - { - // - } - - /** - * Remove the specified resource from storage. - */ - public function destroy(string $id) - { - // - } -} +} \ No newline at end of file diff --git a/resources/views/ruangan.blade.php b/resources/views/ruangan.blade.php index c7c4028..fb7c1e0 100644 --- a/resources/views/ruangan.blade.php +++ b/resources/views/ruangan.blade.php @@ -3,10 +3,11 @@ - Tambah Data Pasien | SIM-RS Anak dan Bunda Harapan Kita + Data Ruang Pelayanan | SIM-RS Anak dan Bunda Harapan Kita -
+
-
+
- -
+ +
-

TAMBAH RUANGAN PELAYANAN

+

DATA RUANG PELAYANAN

Sistem Informasi Manajemen RS Anak dan Bunda Harapan Kita

-
- @csrf - - -
-
-
- -
-
Ruangan Pelayanan
+
+ - - + +
+ +
+ + + + + + + + + + @foreach($ruangPelayanans as $item) + + + + + + + + + + + + @endforeach + +
NoNama Ruang PelayananAksi
{{ $loop->iteration }}{{ $item->nama_ruang_pelayanan }} + + +
+
+ +
+
+ Menampilkan {{ $ruangPelayanans->firstItem() }} - {{ $ruangPelayanans->lastItem() }} dari {{ $ruangPelayanans->total() }} ruang pelayanan +
+
+ {{ $ruangPelayanans->links() }} +
+
- + + +