feat: translation codes
CI / 🧪 Tests Laravel (push) Successful in 2m34s
CI / 🐳 Build & Push Images (push) Successful in 2m26s

This commit is contained in:
2026-08-14 12:46:29 +02:00
parent 69372a49ed
commit 8b60283eeb
28 changed files with 59 additions and 62 deletions
+4 -4
View File
@@ -43,7 +43,7 @@ class ContentModerationService
$apiKey = trim((string) config('moderation.content.openai_key'));
if ($apiKey === '') {
throw new HttpException(503, __('api.moderation.unavailable'));
throw new HttpException(503, 'CONTENT_MODERATION_UNAVAILABLE');
}
$input = [];
@@ -80,7 +80,7 @@ class ContentModerationService
} catch (Throwable $exception) {
report($exception);
throw new HttpException(503, __('api.moderation.unavailable'), $exception);
throw new HttpException(503, 'CONTENT_MODERATION_UNAVAILABLE', $exception);
}
if (collect($response->json('results', []))->contains(
@@ -107,7 +107,7 @@ class ContentModerationService
$contents = file_get_contents($image->getRealPath());
if ($contents === false) {
throw new HttpException(503, __('api.moderation.unavailable'));
throw new HttpException(503, 'CONTENT_MODERATION_UNAVAILABLE');
}
return sprintf(
@@ -126,7 +126,7 @@ class ContentModerationService
private function rejectContent(): never
{
throw ValidationException::withMessages([
'content' => [__('api.moderation.rejected')],
'content' => ['CONTENT_MODERATION_REJECTED'],
]);
}
}