laravel-subscriptions
laravel-subscriptions copied to clipboard
Why overriding Spatie-translatable default getAttributeVlaue with static one??
I'm wondering why you override the default getAttributeValue from Spatie-Translatable with this static config locale???
Spatie method:
public function getAttributeValue($key): mixed
{
if (! $this->isTranslatableAttribute($key)) {
return parent::getAttributeValue($key);
}
return $this->getTranslation($key, $this->getLocale(), $this->useFallbackLocale());
}
Your method:
public function getAttributeValue(mixed $key): mixed
{
if (! $this->isTranslatableAttribute($key)) {
return parent::getAttributeValue($key);
}
return $this->getTranslation($key, config('app.locale')) ?: Arr::first($this->getTranslations($key));
}
Why? Why config('app.locale')??