where('environment', $environment)->first(); } public function upsertToken(string $environment, string $accessToken, ?string $refreshToken, string $expiresAt): void { $existing = $this->getByEnvironment($environment); $row = [ 'environment' => $environment, 'access_token' => $accessToken, 'refresh_token' => $refreshToken, 'expires_at' => $expiresAt, ]; if ($existing) { $this->update($existing['id'], $row); } else { $this->insert($row); } } }