Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Feb 5, 2019
1 parent 9b8d03b commit 3d1eee0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

All notable changes to `laravel-translatable` will be documented in this file

## 3.1.2 - 2019-01-05

- add `hasTranslation`

## 3.1.1 - 2018-12-18

- allow 0 to be used as a translation value
Expand Down
7 changes: 2 additions & 5 deletions src/HasTranslations.php
Expand Up @@ -142,14 +142,11 @@ public function isTranslatableAttribute(string $key) : bool
return in_array($key, $this->getTranslatableAttributes());
}

public function hasTranslation($key, $locale = null)
public function hasTranslation(string $key, string $locale = null): bool
{
$locale = $locale ?: $this->getLocale();
if (isset($this->getTranslations($key)[$locale])) {
return true;
}

return false;
return isset($this->getTranslations($key)[$locale]);

This comment has been minimized.

Copy link
@shaxzodbek-uzb

shaxzodbek-uzb Feb 18, 2019

better: array_key_exists ( mixed $key , array $array ) : bool

}

protected function guardAgainstNonTranslatableAttribute(string $key)
Expand Down

0 comments on commit 3d1eee0

Please sign in to comment.