| @@ 21-32 (lines=12) @@ | ||
| 18 | * @param string $locale |
|
| 19 | * @return string |
|
| 20 | */ |
|
| 21 | public function findByKeyAndLocale($key, $locale = null) |
|
| 22 | { |
|
| 23 | $key = $this->cleanKey($key); |
|
| 24 | ||
| 25 | return $this->cache |
|
| 26 | ->tags($this->entityName, 'global') |
|
| 27 | ->rememberForever("{$this->locale}.{$this->entityName}.findByKeyAndLocale.{$key}.{$locale}", |
|
| 28 | function () use ($key, $locale) { |
|
| 29 | return $this->repository->findByKeyAndLocale($key, $locale); |
|
| 30 | } |
|
| 31 | ); |
|
| 32 | } |
|
| 33 | ||
| 34 | public function allFormatted() |
|
| 35 | { |
|
| @@ 52-63 (lines=12) @@ | ||
| 49 | return $this->repository->saveTranslationForLocaleAndKey($locale, $key, $value); |
|
| 50 | } |
|
| 51 | ||
| 52 | public function findTranslationByKey($key) |
|
| 53 | { |
|
| 54 | $key = $this->cleanKey($key); |
|
| 55 | ||
| 56 | return $this->cache |
|
| 57 | ->tags($this->entityName, 'global') |
|
| 58 | ->rememberForever("{$this->locale}.{$this->entityName}.findTranslationByKey.{$key}", |
|
| 59 | function () use ($key) { |
|
| 60 | return $this->repository->findTranslationByKey($key); |
|
| 61 | } |
|
| 62 | ); |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * Update the given translation key with the given data |
|