From c7975d513e6a94649286f197ddebeb7589821675 Mon Sep 17 00:00:00 2001 From: efbe Date: Fri, 13 Dec 2024 15:36:23 +0700 Subject: [PATCH] add button revoke role user --- app/Http/Controllers/UserController.php | 10 ++++ .../views/user/user_roles_index.blade.php | 47 ++++++++++++++++++- routes/web.php | 1 + 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 8c90e5e..90bd113 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -122,4 +122,14 @@ public function userroles_assign(Request $request){ return redirect()->route('users-roles.index')->with('success','Sukses Memberi Role User'); } +public function userroles_deassign(Request $request){ + $listUser = $request->input('checkboxes', []); + $listUser = $request->input('checkboxes', []); + foreach($listUser as $listUsers) { + $user = User::find($listUsers); + $user->removeRole($request->roles_user); + } + return redirect()->route('users-roles.index')->with('success','Sukses Memberi Role User'); +} + } diff --git a/resources/views/user/user_roles_index.blade.php b/resources/views/user/user_roles_index.blade.php index 717a316..0f20e60 100644 --- a/resources/views/user/user_roles_index.blade.php +++ b/resources/views/user/user_roles_index.blade.php @@ -80,7 +80,9 @@ {{ $loop->iteration }} {{ $datas->name }} - | + | + | + + + + + +