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")]