Skip to content

Commit

Permalink
Replace config('app.locale') with getLocale() (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdgroot authored and freekmurze committed Jan 24, 2018
1 parent 3025950 commit 5b81691
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/HasTranslations.php
Expand Up @@ -19,7 +19,7 @@ public function getAttributeValue($key)
return parent::getAttributeValue($key);
}

return $this->getTranslation($key, config('app.locale'));
return $this->getTranslation($key, $this->getLocale());
}

/**
Expand All @@ -38,7 +38,7 @@ public function setAttribute($key, $value)
}
// if the attribute is translatable and not already translated (=array),
// set a translation for the current app locale
return $this->setTranslation($key, config('app.locale'), $value);
return $this->setTranslation($key, $this->getLocale(), $value);
}

/**
Expand Down Expand Up @@ -196,6 +196,11 @@ protected function normalizeLocale(string $key, string $locale, bool $useFallbac
return $locale;
}

protected function getLocale() : string
{
return config('app.locale');
}

public function getTranslatableAttributes() : array
{
return is_array($this->translatable)
Expand Down

0 comments on commit 5b81691

Please sign in to comment.