refactor(user): role_id 2 bisa crud pengguna dan role_id 3 tidak bisa(ditukar)
This commit is contained in:
parent
3bfe048ce6
commit
84fb7885ad
@ -6,7 +6,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@if (in_array(auth()->user()->role_id, [1, 3]))
|
||||
@if (in_array(auth()->user()->role_id, [1, 2]))
|
||||
<div class="list-product-header">
|
||||
<div>
|
||||
<a class="btn btn-primary" href="{{ route('master.user.create') }}">Tambah</a>
|
||||
@ -29,7 +29,7 @@
|
||||
<th>Gaji Pokok</th>
|
||||
<th>Status</th>
|
||||
<th>Tanggal Bekerja</th>
|
||||
@if (in_array(auth()->user()->role_id, [1, 3]))
|
||||
@if (in_array(auth()->user()->role_id, [1, 2]))
|
||||
<th>Aksi</th>
|
||||
@endif
|
||||
</tr>
|
||||
@ -51,7 +51,7 @@
|
||||
: '<span class="badge bg-danger">Tidak Aktif</span>' !!}
|
||||
</td>
|
||||
<td>{{ formatDateIndo($user->entry_date) }}</td>
|
||||
@if (in_array(auth()->user()->role_id, [1, 3]))
|
||||
@if (in_array(auth()->user()->role_id, [1, 2]))
|
||||
<td>
|
||||
<ul class="action">
|
||||
<li class="{{ $user->is_active ? 'nonactivate' : '7366ff' }}">
|
||||
@ -105,7 +105,7 @@
|
||||
<i data-feather="edit"></i>
|
||||
</a>
|
||||
</li>
|
||||
@if (auth()->user()->role_id === 1)
|
||||
@if (in_array(auth()->user()->role_id, [1, 2]))
|
||||
<li class="delete">
|
||||
<form
|
||||
action="{{ route('master.user.delete', encryptId($user->id)) }}"
|
||||
|
||||
@ -49,15 +49,15 @@
|
||||
|
||||
Route::get('/users', [UserController::class, 'index'])->name('master.users');
|
||||
Route::prefix('user')->group(function () {
|
||||
Route::middleware(['check_role:1,3'])->group(function () {
|
||||
Route::middleware(['check_role:1,2'])->group(function () {
|
||||
Route::get('create', [UserController::class, 'create'])->name('master.user.create');
|
||||
Route::post('store', [UserController::class, 'store'])->name('master.user.store');
|
||||
Route::get('edit/{user}', [UserController::class, 'edit'])->name('master.user.edit');
|
||||
Route::put('update/{user}', [UserController::class, 'update'])->name('master.user.update');
|
||||
Route::put('reset-password/{user}', [UserController::class, 'resetPassword'])->name('master.user.resetPassword');
|
||||
Route::put('activation/{user}', [UserController::class, 'activation'])->name('master.user.activation');
|
||||
Route::delete('delete/{user}', [UserController::class, 'delete'])->name('master.user.delete');
|
||||
});
|
||||
Route::delete('delete/{user}', [UserController::class, 'delete'])->name('master.user.delete')->middleware('check_role:1');
|
||||
});
|
||||
|
||||
Route::get('/customers', [CustomerController::class, 'index'])->name('master.customers');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user