refactor: code style changes

Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
2023-01-15 00:04:00 +00:00
parent 25155bff2e
commit 3727c84f3e
146 changed files with 1013 additions and 1341 deletions

View File

@@ -4,31 +4,29 @@ namespace App\Services;
use App\User;
use Illuminate\Http\Client\RequestException;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Http;
class DiscordService
{
/**
* Sends a token revocation request to Discord to invalidate a specific $user's tokens.
* Please ensure you have the user set a password for their account after this, or request new tokens.
*
* @see https://www.rfc-editor.org/rfc/rfc7009
* @param User $user
*
* @param User $user
* @return bool
*
* @throws RequestException
*/
public function revokeAccountTokens(User $user): bool
{
$req = Http::asForm()->post(config('services.discord.base_url') . '/oauth2/token/revoke', [
$req = Http::asForm()->post(config('services.discord.base_url').'/oauth2/token/revoke', [
'client_id' => config('services.discord.client_id'),
'client_secret' => config('services.discord.client_secret'),
'token' => $user->discord_token,
])->throw();
$user->discord_token = null;
$user->discord_user_id = null;
$user->discord_refresh_token = null;
@@ -37,6 +35,4 @@ class DiscordService
return $req->ok();
}
}