From 97f766db27a4b4ba3f2abcce41aee70aa467627b Mon Sep 17 00:00:00 2001 From: Jens <34610614+AGuyNamedJens@users.noreply.github.com> Date: Tue, 19 Jul 2022 20:27:16 +0200 Subject: [PATCH] Update UserController.php Fixes an issue when you update a user, it's impossible to update it, the check for referral_code is invalid. Fixed: - Deletes the custom check and uses laravel's check to ensure it's valid. --- app/Http/Controllers/Admin/UserController.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 1f4bedff..3deae9d1 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -123,15 +123,9 @@ class UserController extends Controller "credits" => "required|numeric|min:0|max:99999999", "server_limit" => "required|numeric|min:0|max:1000000", "role" => Rule::in(['admin', 'mod', 'client', 'member']), - "referral_code" => "required|string|min:2|max:32", + "referral_code" => "required|string|min:2|max:32|unique:users,referral_code,{$user->id}", ]); - if (User::where('referral_code', '=', $request->input('referral_code'))->exists()) { - throw ValidationException::withMessages([ - 'referral_code' => [__("Another User with this Referral-Code already exists!")] - ]); - } - if (isset($this->pterodactyl->getUser($request->input('pterodactyl_id'))['errors'])) { throw ValidationException::withMessages([ 'pterodactyl_id' => [__("User does not exists on pterodactyl's panel")]