Tambahkan kolom role di tabel pengguna
Mengubah query di UsersController untuk mengambil data roles. Memperbarui tampilan di users/index.blade.php untuk menampilkan kolom role dengan informasi yang sesuai.
This commit is contained in:
@@ -105,7 +105,7 @@
|
||||
$filteredRecords = $query->count();
|
||||
|
||||
// Get the data for the current page
|
||||
$users = $query->with('branch')->get();
|
||||
$users = $query->with(['branch','roles'])->get();
|
||||
|
||||
// Calculate the page count
|
||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||
|
||||
@@ -72,6 +72,10 @@
|
||||
<span class="sort"> <span class="sort-label"> Branch </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[185px]" data-datatable-column="role">
|
||||
<span class="sort"> <span class="sort-label"> Role </span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -162,6 +166,12 @@
|
||||
return data.branch.name;
|
||||
},
|
||||
},
|
||||
role: {
|
||||
title: 'Role',
|
||||
render: (item, data) => {
|
||||
return data.roles.map(role => role.name).join(', ');
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
title: 'Status',
|
||||
render: (item, data) => {
|
||||
|
||||
Reference in New Issue
Block a user