Data Master (Guru & Walimurid)

yang belum peserta didik
This commit is contained in:
ghozahimma65 2025-11-10 11:24:32 +07:00
parent 51d502ff57
commit 34788caf83
14 changed files with 258 additions and 174 deletions

View File

@ -4,63 +4,57 @@
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\WaliMurid; use App\Models\WaliMurid;
use App\Models\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class WaliMuridController extends Controller class WaliMuridController extends Controller
{ {
public function index() public function index()
{ {
// ambil semua wali murid + user terkait $wali_murids = WaliMurid::orderBy('created_at', 'desc')->get();
$wali = WaliMurid::with('user')->get(); return view('admin.wali_murid.index', compact('wali_murids'));
return view('admin.wali.index', compact('wali'));
} }
public function create() public function create()
{ {
// ambil data user untuk dropdown (jika sudah punya akun) return view('admin.wali_murid.create');
$users = User::where('role', 'wali')->get();
return view('admin.wali.create', compact('users'));
} }
public function store(Request $request) public function store(Request $request)
{ {
$request->validate([ $request->validate([
'nama' => 'required|string|max:255', 'nama_wali' => 'required|string|max:100',
'alamat' => 'nullable|string', 'email' => 'nullable|email|max:100',
'lokasi_lat' => 'nullable|numeric', 'no_hp' => 'nullable|string|max:20',
'lokasi_lng' => 'nullable|numeric', 'alamat' => 'nullable|string|max:255',
]); ]);
WaliMurid::create($request->all()); WaliMurid::create($request->only(['nama_wali', 'email', 'no_hp', 'alamat']));
return redirect()->route('wali.index')->with('success', 'Wali Murid berhasil ditambahkan'); return redirect()->route('wali-murid.index')->with('success', 'Data wali murid berhasil ditambahkan.');
} }
public function edit(WaliMurid $wali_murid)
public function edit(WaliMurid $wali)
{ {
$users = User::where('role', 'wali')->get(); return view('admin.wali_murid.edit', compact('wali_murid'));
return view('admin.wali.edit', compact('wali', 'users'));
} }
public function update(Request $request, WaliMurid $wali) public function update(Request $request, WaliMurid $wali_murid)
{ {
$request->validate([ $request->validate([
'nama' => 'required|string|max:255', 'nama_wali' => 'required|string|max:100',
'alamat' => 'nullable|string', 'email' => 'nullable|email|max:100',
'lokasi_lat' => 'nullable|numeric', 'no_hp' => 'nullable|string|max:20',
'lokasi_lng' => 'nullable|numeric', 'alamat' => 'nullable|string|max:255',
]); ]);
$wali->update($request->all()); $wali_murid->update($request->all());
return redirect()->route('wali.index')->with('success', 'Wali Murid berhasil diperbarui'); return redirect()->route('wali-murid.index')->with('success', 'Data wali murid berhasil diperbarui.');
} }
public function destroy(WaliMurid $wali) public function destroy(WaliMurid $wali_murid)
{ {
$wali->delete(); $wali_murid->delete();
return redirect()->route('wali.index')->with('success', 'Wali Murid berhasil dihapus'); return redirect()->route('wali-murid.index')->with('success', 'Data wali murid berhasil dihapus.');
} }
} }

View File

@ -2,21 +2,19 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class WaliMurid extends Model class WaliMurid extends Model
{ {
use HasFactory;
protected $table = 'wali_murids'; protected $table = 'wali_murids';
protected $fillable = ['user_id','alamat','lokasi_lat','lokasi_lng'];
public function user() protected $fillable = [
{ 'nama_wali',
return $this->belongsTo(User::class); 'email',
} 'no_hp',
'alamat',
public function siswa() ];
{ }
return $this->hasMany(Siswa::class,'wali_id');
}
}

View File

@ -6,40 +6,28 @@
<form action="{{ route('guru.store') }}" method="POST"> <form action="{{ route('guru.store') }}" method="POST">
@csrf @csrf
<div class="mb-4"> <div class="mb-4">
<label class="block text-gray-700 mb-1">Nama</label> <label class="block text-gray-700">Nama</label>
<input type="text" name="nama" <input type="text" name="nama_guru" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300" required>
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300" required>
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="block text-gray-700 mb-1">Bidang</label> <label class="block text-gray-700">Bidang</label>
<input type="text" name="bidang" <input type="text" name="bidang" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="block text-gray-700 mb-1">Telepon</label> <label class="block text-gray-700">No HP</label>
<input type="text" name="telepon" <input type="text" name="no_hp" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="block text-gray-700 mb-1">Alamat</label> <label class="block text-gray-700">Email</label>
<input type="text" name="alamat" <input type="email" name="email" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
</div> </div>
<div class="mt-6 flex gap-3"> <button type="submit" class="bg-green-500 text-white px-4 py-2 rounded hover:bg-green-600">Simpan</button>
<button type="submit"
class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 transition">
Simpan
</button>
<a href="{{ route('guru.index') }}"
class="bg-gray-400 text-white px-4 py-2 rounded hover:bg-gray-500 transition">
Batal
</a>
</div>
</form> </form>
</div> </div>
@endsection @endsection

View File

@ -9,43 +9,26 @@
@method('PUT') @method('PUT')
<div class="mb-4"> <div class="mb-4">
<label class="block text-gray-700 mb-1">Nama</label> <label class="block text-gray-700">Nama</label>
<input type="text" name="nama" <input type="text" name="nama_guru" value="{{ $guru->nama_guru }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300" required>
value="{{ $guru->nama }}"
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300" required>
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="block text-gray-700 mb-1">Bidang</label> <label class="block text-gray-700">Bidang</label>
<input type="text" name="bidang" <input type="text" name="bidang" value="{{ $guru->bidang }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
value="{{ $guru->bidang }}"
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="block text-gray-700 mb-1">Telepon</label> <label class="block text-gray-700">No HP</label>
<input type="text" name="telepon" <input type="text" name="no_hp" value="{{ $guru->no_hp }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
value="{{ $guru->telepon }}"
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="block text-gray-700 mb-1">Alamat</label> <label class="block text-gray-700">Email</label>
<input type="text" name="alamat" <input type="email" name="email" value="{{ $guru->email }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
value="{{ $guru->alamat }}"
class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
</div> </div>
<div class="mt-6 flex gap-3"> <button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Perbarui</button>
<button type="submit"
class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 transition">
Update
</button>
<a href="{{ route('guru.index') }}"
class="bg-gray-400 text-white px-4 py-2 rounded hover:bg-gray-500 transition">
Batal
</a>
</div>
</form> </form>
</div> </div>
@endsection @endsection

View File

@ -1,43 +1,44 @@
@extends('layouts.admin') @extends('layouts.app')
@section('content') @section('content')
<div class="container"> <div class="bg-white shadow-md rounded-lg p-6">
<h4 class="mb-3">📚 Data Guru</h4> <div class="flex justify-between items-center mb-4">
<h1 class="text-xl font-semibold text-gray-700">👨‍🏫 Data Guru</h1>
<a href="{{ route('guru.create') }}" class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700">+ Tambah Guru</a>
</div>
<a href="{{ route('guru.create') }}" class="btn btn-success mb-3">+ Tambah Guru</a> <table class="w-full border-collapse">
<thead>
<table class="table table-bordered"> <tr class="bg-green-600 text-white text-left">
<thead class="table-success"> <th class="p-2">#</th>
<tr><q></q> <th class="p-2">Nama Guru</th>
<th>No</th> <th class="p-2">Email</th>
<th>Nama Guru</th> <th class="p-2">No HP</th>
<th>Email</th> <th class="p-2">Bidang</th>
<th>No HP</th> <th class="p-2">Aksi</th>
<th>Bidang</th>
<th>Aksi</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@forelse ($gurus as $guru) @forelse ($gurus as $i => $guru)
<tr> <tr class="border-b hover:bg-gray-50">
<td>{{ $loop->iteration }}</td> <td class="p-2">{{ $i + 1 }}</td>
<td>{{ $guru->nama_guru }}</td> <td class="p-2">{{ $guru->nama_guru ?? '-' }}</td>
<td>{{ $guru->email }}</td> <td class="p-2">{{ $guru->email ?? '-' }}</td>
<td>{{ $guru->no_hp }}</td> <td class="p-2">{{ $guru->no_hp ?? '-' }}</td>
<td>{{ $guru->bidang }}</td> <td class="p-2">{{ $guru->bidang ?? '-' }}</td>
<td> <td class="p-2 space-x-2">
<a href="{{ route('guru.edit', $guru->id) }}" class="btn btn-sm btn-warning">Edit</a> <a href="{{ route('guru.edit', $guru->id) }}" class="text-blue-500 hover:underline">Edit</a>
<form action="{{ route('guru.destroy', $guru->id) }}" method="POST" class="d-inline"> <form action="{{ route('guru.destroy', $guru->id) }}" method="POST" class="inline" onsubmit="return confirm('Yakin hapus data ini?');">
@csrf @csrf
@method('DELETE') @method('DELETE')
<button class="btn btn-sm btn-danger" onclick="return confirm('Yakin?')">Hapus</button> <button type="submit" class="text-red-500 hover:underline">Hapus</button>
</form> </form>
</td> </td>
</tr> </tr>
@empty @empty
<tr> <tr>
<td colspan="6" class="text-center">Belum ada data guru</td> <td colspan="6" class="text-center text-gray-500 py-4">Belum ada data guru</td>
</tr> </tr>
@endforelse @endforelse
</tbody> </tbody>
</table> </table>

View File

@ -1,33 +1,33 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<div class="bg-white p-6 rounded-lg shadow w-1/2 mx-auto"> <div class="bg-white shadow-md rounded-lg p-6 max-w-xl mx-auto">
<h2 class="text-xl font-semibold mb-4">Tambah Wali Murid</h2> <h1 class="text-xl font-semibold text-gray-700 mb-4"> Tambah Wali Murid</h1>
<form action="{{ route('wali.store') }}" method="POST"> <form action="{{ route('wali-murid.store') }}" method="POST">
@csrf @csrf
<div class="mb-4"> <div class="mb-4">
<label class="block mb-1">Nama</label> <label class="block text-gray-700 mb-1">Nama Wali Murid</label>
<input type="text" name="nama" class="w-full border rounded p-2" required> <input type="text" name="nama_wali" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300" required>
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="block mb-1">Alamat</label> <label class="block text-gray-700 mb-1">Email</label>
<input type="text" name="alamat" class="w-full border rounded p-2"> <input type="email" name="email" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="block mb-1">Lokasi Latitude</label> <label class="block text-gray-700 mb-1">No HP</label>
<input type="text" name="lokasi_lat" class="w-full border rounded p-2"> <input type="text" name="no_hp" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="block mb-1">Lokasi Longitude</label> <label class="block text-gray-700 mb-1">Alamat</label>
<input type="text" name="lokasi_lng" class="w-full border rounded p-2"> <textarea name="alamat" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300"></textarea>
</div> </div>
<button type="submit" class="px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700">Simpan</button> <button type="submit" class="bg-green-500 text-white px-4 py-2 rounded hover:bg-green-600">Simpan</button>
<a href="{{ route('wali.index') }}" class="ml-2 px-4 py-2 bg-gray-300 rounded">Batal</a>
</form> </form>
</div> </div>
@endsection @endsection

View File

@ -1,33 +1,34 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<div class="bg-white p-6 rounded-lg shadow w-1/2 mx-auto"> <div class="bg-white shadow-md rounded-lg p-6 max-w-xl mx-auto">
<h2 class="text-xl font-semibold mb-4">Edit Wali Murid</h2> <h1 class="text-xl font-semibold text-gray-700 mb-4">✏️ Edit Wali Murid</h1>
<form action="{{ route('wali-murid.update', $wali_murid->id) }}" method="POST">
@csrf
@method('PUT')
<form action="{{ route('wali.update', $wali->id) }}" method="POST">
@csrf @method('PUT')
<div class="mb-4"> <div class="mb-4">
<label class="block mb-1">Nama</label> <label class="block text-gray-700 mb-1">Nama Wali Murid</label>
<input type="text" name="nama" class="w-full border rounded p-2" value="{{ $wali->nama }}" required> <input type="text" name="nama_wali" value="{{ $wali_murid->nama_wali }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300" required>
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="block mb-1">Alamat</label> <label class="block text-gray-700 mb-1">Email</label>
<input type="text" name="alamat" class="w-full border rounded p-2" value="{{ $wali->alamat }}"> <input type="email" name="email" value="{{ $wali_murid->email }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="block mb-1">Lokasi Latitude</label> <label class="block text-gray-700 mb-1">No HP</label>
<input type="text" name="lokasi_lat" class="w-full border rounded p-2" value="{{ $wali->lokasi_lat }}"> <input type="text" name="no_hp" value="{{ $wali_murid->no_hp }}" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="block mb-1">Lokasi Longitude</label> <label class="block text-gray-700 mb-1">Alamat</label>
<input type="text" name="lokasi_lng" class="w-full border rounded p-2" value="{{ $wali->lokasi_lng }}"> <textarea name="alamat" class="w-full border rounded px-3 py-2 focus:ring focus:ring-green-300">{{ $wali_murid->alamat }}</textarea>
</div> </div>
<button type="submit" class="px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700">Update</button> <button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Perbarui</button>
<a href="{{ route('wali.index') }}" class="ml-2 px-4 py-2 bg-gray-300 rounded">Batal</a>
</form> </form>
</div> </div>
@endsection @endsection

View File

@ -3,8 +3,8 @@
@section('content') @section('content')
<div class="bg-white shadow-md rounded-lg p-6"> <div class="bg-white shadow-md rounded-lg p-6">
<div class="flex justify-between items-center mb-4"> <div class="flex justify-between items-center mb-4">
<h1 class="text-xl font-semibold text-gray-700">👪 Data Wali Murid</h1> <h1 class="text-xl font-semibold text-gray-700">👨‍👩‍👧 Data Wali Murid</h1>
<a href="{{ route('wali.create') }}" <a href="{{ route('wali-murid.create') }}"
class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 transition"> class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 transition">
+ Tambah Wali Murid + Tambah Wali Murid
</a> </a>
@ -14,39 +14,33 @@ class="bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700 transition">
<thead> <thead>
<tr class="bg-green-600 text-white text-left"> <tr class="bg-green-600 text-white text-left">
<th class="p-2">#</th> <th class="p-2">#</th>
<th class="p-2">Nama</th> <th class="p-2">Nama Wali Murid</th>
<th class="p-2">Email</th>
<th class="p-2">No HP</th>
<th class="p-2">Alamat</th> <th class="p-2">Alamat</th>
<th class="p-2">Lokasi (Lat, Lng)</th>
<th class="p-2">Aksi</th> <th class="p-2">Aksi</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@forelse ($wali as $i => $item) @forelse($wali_murids as $i => $wali)
<tr class="border-b hover:bg-gray-50"> <tr class="border-b hover:bg-gray-50">
<td class="p-2">{{ $i+1 }}</td> <td class="p-2">{{ $i + 1 }}</td>
<td class="p-2">{{ $item->nama ?? '-' }}</td> <td class="p-2">{{ $wali->nama_wali ?? '-' }}</td>
<td class="p-2">{{ $item->alamat ?? '-' }}</td> <td class="p-2">{{ $wali->email ?? '-' }}</td>
<td class="p-2"> <td class="p-2">{{ $wali->no_hp ?? '-' }}</td>
{{ $item->lokasi_lat ?? '-' }}, {{ $item->lokasi_lng ?? '-' }} <td class="p-2">{{ $wali->alamat ?? '-' }}</td>
</td> <td class="p-2 space-x-2">
<td class="p-2 flex gap-2"> <a href="{{ route('wali-murid.edit', $wali->id) }}" class="text-blue-500 hover:underline">Edit</a>
<a href="{{ route('wali.edit', $item->id) }}" <form action="{{ route('wali-murid.destroy', $wali->id) }}" method="POST" class="inline" onsubmit="return confirm('Yakin hapus data ini?');">
class="bg-blue-500 text-white px-3 py-1 rounded hover:bg-blue-600">
Edit
</a>
<form action="{{ route('wali.destroy', $item->id) }}" method="POST" onsubmit="return confirm('Yakin ingin menghapus data ini?')">
@csrf @csrf
@method('DELETE') @method('DELETE')
<button type="submit" <button type="submit" class="text-red-500 hover:underline">Hapus</button>
class="bg-red-500 text-white px-3 py-1 rounded hover:bg-red-600">
Hapus
</button>
</form> </form>
</td> </td>
</tr> </tr>
@empty @empty
<tr> <tr>
<td colspan="5" class="text-center text-gray-500 p-4">Belum ada data wali murid</td> <td colspan="6" class="text-center text-gray-500 py-4">Belum ada data wali murid.</td>
</tr> </tr>
@endforelse @endforelse
</tbody> </tbody>

View File

@ -0,0 +1,36 @@
@extends('layouts.app')
@section('content')
<div class="bg-white shadow-md rounded-lg p-6">
<h2 class="text-xl font-semibold mb-4">Tambah Data Wali Murid</h2>
<form action="{{ route('wali-murid.store') }}" method="POST" class="space-y-4">
@csrf
<div>
<label class="block text-gray-700 font-medium">Nama Wali</label>
<input type="text" name="nama_wali" class="w-full border rounded p-2" required>
</div>
<div>
<label class="block text-gray-700 font-medium">Email</label>
<input type="email" name="email" class="w-full border rounded p-2">
</div>
<div>
<label class="block text-gray-700 font-medium">No HP</label>
<input type="text" name="no_hp" class="w-full border rounded p-2">
</div>
<div>
<label class="block text-gray-700 font-medium">Alamat</label>
<textarea name="alamat" rows="3" class="w-full border rounded p-2"></textarea>
</div>
<div class="flex justify-end gap-2">
<a href="{{ route('wali-murid.index') }}" class="px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600">Batal</a>
<button type="submit" class="px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700">Simpan</button>
</div>
</form>
</div>
@endsection

View File

@ -0,0 +1,37 @@
@extends('layouts.app')
@section('content')
<div class="bg-white shadow-md rounded-lg p-6">
<h2 class="text-xl font-semibold mb-4">Edit Data Wali Murid</h2>
<form action="{{ route('wali-murid.update', $wali_murid->id) }}" method="POST" class="space-y-4">
@csrf
@method('PUT')
<div>
<label class="block text-gray-700 font-medium">Nama Wali</label>
<input type="text" name="nama_wali" class="w-full border rounded p-2" value="{{ $wali_murid->nama_wali }}" required>
</div>
<div>
<label class="block text-gray-700 font-medium">Email</label>
<input type="email" name="email" class="w-full border rounded p-2" value="{{ $wali_murid->email }}">
</div>
<div>
<label class="block text-gray-700 font-medium">No HP</label>
<input type="text" name="no_hp" class="w-full border rounded p-2" value="{{ $wali_murid->no_hp }}">
</div>
<div>
<label class="block text-gray-700 font-medium">Alamat</label>
<textarea name="alamat" rows="3" class="w-full border rounded p-2">{{ $wali_murid->alamat }}</textarea>
</div>
<div class="flex justify-end gap-2">
<a href="{{ route('wali-murid.index') }}" class="px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600">Batal</a>
<button type="submit" class="px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700">Update</button>
</div>
</form>
</div>
@endsection

View File

@ -0,0 +1,47 @@
@extends('layouts.app')
@section('content')
<div class="bg-white shadow-md rounded-lg p-6">
<div class="flex justify-between items-center mb-4">
<h2 class="text-xl font-semibold flex items-center gap-2">
👨‍👩‍👧 Data Wali Murid
</h2>
<a href="{{ route('wali-murid.create') }}" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg">+ Tambah Wali Murid</a>
</div>
<table class="w-full border-collapse">
<thead class="bg-green-700 text-white">
<tr>
<th class="p-3 text-left">#</th>
<th class="p-3 text-left">Nama Wali</th>
<th class="p-3 text-left">Email</th>
<th class="p-3 text-left">No HP</th>
<th class="p-3 text-left">Alamat</th>
<th class="p-3 text-left">Aksi</th>
</tr>
</thead>
<tbody>
@forelse ($wali_murids as $wali)
<tr class="border-b hover:bg-gray-100">
<td class="p-3">{{ $loop->iteration }}</td>
<td class="p-3">{{ $wali->nama_wali }}</td>
<td class="p-3">{{ $wali->email }}</td>
<td class="p-3">{{ $wali->no_hp }}</td>
<td class="p-3">{{ $wali->alamat }}</td>
<td class="p-3 flex gap-2">
<a href="{{ route('wali-murid.edit', $wali->id) }}" class="text-blue-600 hover:underline">Edit</a>
<form action="{{ route('wali-murid.destroy', $wali->id) }}" method="POST" onsubmit="return confirm('Yakin ingin menghapus data ini?');">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:underline">Hapus</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="p-3 text-center text-gray-500">Belum ada data wali murid.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@endsection

View File

@ -21,7 +21,7 @@
<p class="font-semibold uppercase text-xs mb-2">Data Master</p> <p class="font-semibold uppercase text-xs mb-2">Data Master</p>
<ul class="ml-4 space-y-1"> <ul class="ml-4 space-y-1">
<li><a href="{{ route('guru.index') }}" class="block p-2 hover:bg-green-700 rounded">👨‍🏫 Guru</a></li> <li><a href="{{ route('guru.index') }}" class="block p-2 hover:bg-green-700 rounded">👨‍🏫 Guru</a></li>
<li><a href="{{ route('wali.index') }}" class="block p-2 hover:bg-green-700 rounded">👪 Wali Murid</a></li> <li><a href="{{ route('wali-murid.index') }}"class="block p-2 hover:bg-green-700 rounded">👪 Wali Murid</a></li>
<li><a href="{{ route('siswa.index') }}" class="block p-2 hover:bg-green-700 rounded">🧒 Peserta Didik</a></li> <li><a href="{{ route('siswa.index') }}" class="block p-2 hover:bg-green-700 rounded">🧒 Peserta Didik</a></li>
</ul> </ul>
</div> </div>
@ -70,6 +70,11 @@ class="px-4 py-2 rounded-lg border focus:ring-2 focus:ring-green-400 w-72 text-s
<!-- Content --> <!-- Content -->
<main class="p-6"> <main class="p-6">
@yield('content') @yield('content')
@if (session('success'))
<div class="bg-green-100 text-green-800 p-3 rounded mb-4">
{{ session('success') }}
</div>
@endif
</main> </main>
</div> </div>

View File

@ -29,7 +29,7 @@
'destroy' => 'api.guru.destroy', 'destroy' => 'api.guru.destroy',
]); ]);
Route::apiResource('wali', WaliMuridController::class)->names([ Route::apiResource('wali', WaliMuridController::class)->names([
'index' => 'api.wali.index', 'index' => 'api.wali-murid.index',
'show' => 'api.wali.show', 'show' => 'api.wali.show',
'store' => 'api.wali.store', 'store' => 'api.wali.store',
'update' => 'api.wali.update', 'update' => 'api.wali.update',

View File

@ -26,7 +26,7 @@
Route::prefix('admin')->group(function () { Route::prefix('admin')->group(function () {
Route::resource('guru', GuruController::class); Route::resource('guru', GuruController::class);
Route::resource('wali', WaliMuridController::class); Route::resource('wali-murid', WaliMuridController::class);
Route::resource('siswa', SiswaController::class); Route::resource('siswa', SiswaController::class);
Route::middleware(['auth'])->group(function () { Route::middleware(['auth'])->group(function () {