We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8bad537 commit bfee0eaCopy full SHA for bfee0ea
src/Traits/IsTranslatable.php
@@ -210,9 +210,12 @@ public function getAttribute($key): mixed
210
}, $key);
211
}
212
213
- // translate using current app locale if possible
+ // Translate using the current app locale if possible
214
if ($this->isTranslatable($key)) {
215
- return $this->translate($key, app()->currentLocale());
+ $translated_value = $this->translate($key, app()->currentLocale());
216
+
217
+ // Return translated value if not null, otherwise fallback to original value
218
+ return $translated_value ?? parent::getAttribute($key);
219
220
221
// check if is a suffixed attribute
0 commit comments