Added API Route

This commit is contained in:
1Day 2021-12-27 09:10:38 +01:00
parent 8a583424db
commit b72009aa84

View file

@ -88,9 +88,24 @@ class UserController extends Controller
"role" => ['sometimes', Rule::in(['admin', 'mod', 'client', 'member'])],
]);
$user->update($request->all());
event(new UserUpdateCreditsEvent($user));
//Update Users Password on Pterodactyl
//Username,Mail,First and Lastname are required aswell
$response = Pterodactyl::client()->patch('/application/users/'.$user->pterodactyl_id, [
"username" => $request->name,
"first_name" => $request->name,
"last_name" => $request->name,
"email" => $request->email,
]);
if ($response->failed()) {
throw ValidationException::withMessages([
'pterodactyl_error_message' => $response->toException()->getMessage(),
'pterodactyl_error_status' => $response->toException()->getCode()
]);
}
$user->update($request->all());
return $user;
}