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();
|
$filteredRecords = $query->count();
|
||||||
|
|
||||||
// Get the data for the current page
|
// Get the data for the current page
|
||||||
$users = $query->with('branch')->get();
|
$users = $query->with(['branch','roles'])->get();
|
||||||
|
|
||||||
// Calculate the page count
|
// Calculate the page count
|
||||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||||
|
|||||||
@@ -72,6 +72,10 @@
|
|||||||
<span class="sort"> <span class="sort-label"> Branch </span>
|
<span class="sort"> <span class="sort-label"> Branch </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</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>
|
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -162,6 +166,12 @@
|
|||||||
return data.branch.name;
|
return data.branch.name;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
role: {
|
||||||
|
title: 'Role',
|
||||||
|
render: (item, data) => {
|
||||||
|
return data.roles.map(role => role.name).join(', ');
|
||||||
|
},
|
||||||
|
},
|
||||||
actions: {
|
actions: {
|
||||||
title: 'Status',
|
title: 'Status',
|
||||||
render: (item, data) => {
|
render: (item, data) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user