fix: hak akses role - tambah label & cache untuk role other

- Role label: Other (Guest) di tabel permission
- Cache di-clearing untuk role 'other' setelah update
- Semua role dinamis dari controller
This commit is contained in:
Bro
2026-07-24 19:17:15 +07:00
parent 6f33f7712d
commit 89e97c3679
2 changed files with 11 additions and 2 deletions
@@ -69,7 +69,7 @@ class PermissionController extends Controller
} }
// Clear cache // Clear cache
foreach (['admin', 'bk', 'wali_kelas', 'staff'] as $role) { foreach (['admin', 'bk', 'wali_kelas', 'staff', 'other'] as $role) {
Cache::forget('role_permissions:' . $role); Cache::forget('role_permissions:' . $role);
} }
+10 -1
View File
@@ -22,7 +22,16 @@
<tr class="bg-gray-50 border-b border-gray-200"> <tr class="bg-gray-50 border-b border-gray-200">
<th class="text-left px-4 py-3 font-semibold text-gray-700">Permission</th> <th class="text-left px-4 py-3 font-semibold text-gray-700">Permission</th>
@foreach ($roles as $role) @foreach ($roles as $role)
<th class="text-center px-3 py-3 font-semibold text-gray-700 capitalize">{{ $role }}</th> @php
$label = [
'admin' => 'Admin',
'bk' => 'BK',
'wali_kelas' => 'Wali Kelas',
'staff' => 'Staff',
'other' => 'Other (Guest)',
][$role] ?? ucfirst($role);
@endphp
<th class="text-center px-3 py-3 font-semibold text-gray-700">{{ $label }}</th>
@endforeach @endforeach
</tr> </tr>
</thead> </thead>