Skip to content
This repository has been archived by the owner on Aug 17, 2021. It is now read-only.

Commit

Permalink
Check if locale isn't null instead of if property exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
koenhoeijmakers authored Nov 19, 2018
1 parent db559ab commit 44508fa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/HasTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ public function getTranslationValue(string $locale, string $name)
*/
public function getLocaleKeyName(): string
{
return property_exists($this, 'localeKeyName') ? $this->localeKeyName
return property_exists($this, 'localeKeyName')
? $this->localeKeyName
: config('translatable.locale_key_name', 'locale');
}

Expand All @@ -219,7 +220,9 @@ public function getLocaleKeyName(): string
*/
public function getLocale(): string
{
return property_exists($this, 'currentLocale') ? $this->currentLocale : app()->getLocale();
return null !== $this->currentLocale
? $this->currentLocale
: app()->getLocale();
}

/**
Expand Down

0 comments on commit 44508fa

Please sign in to comment.