Skip to content

Commit 9f4aaaf

Browse files
authored
Fallback to attribute if translation not found
1 parent c0295e8 commit 9f4aaaf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Traits/Translatable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function translate(string $key, ?string $locale = null): mixed
2727

2828
return match ($locale) {
2929
(Translation::proxy())::getTranslatableLocale() => $this->getAttribute($key),
30-
default => $this->translations->firstWhere('locale', $locale)?->values[$key] ?? null,
30+
default => $this->translations->firstWhere('locale', $locale)?->values[$key] ?? $this->getAttribute($key),
3131
};
3232
}
3333
}

0 commit comments

Comments
 (0)