diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 09d1616..31c2a89 100755 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -65,7 +65,7 @@ class AdminController extends Controller return view('panel/users', $data); } - //Block user and delete their links + //Block user public function blockUser(request $request) { $id = $request->id; @@ -79,8 +79,6 @@ class AdminController extends Controller User::where('id', $id)->update(['block' => $block]); - Link::where('user_id', $id)->delete(); - return redirect('panel/users/all'); } @@ -131,6 +129,17 @@ class AdminController extends Controller return redirect('panel/edit-user/'. $user->id); } + //Delete existing user + public function deleteUser(request $request) + { + $id = $request->id; + + $user = User::find($id); + $user->forceDelete(); + + return redirect('panel/users/all'); + } + //Show user to edit public function showUser(request $request) { @@ -191,7 +200,7 @@ class AdminController extends Controller $profilePhoto->move(base_path('/img'), $littlelink_name . ".png"); } - return back(); + return redirect('panel/users/all'); } //Show site pages to edit diff --git a/resources/views/panel/users.blade.php b/resources/views/panel/users.blade.php index 7c9e042..4e8bed0 100755 --- a/resources/views/panel/users.blade.php +++ b/resources/views/panel/users.blade.php @@ -27,6 +27,7 @@