| @@ 339-346 (lines=8) @@ | ||
| 336 | { |
|
| 337 | $locale = $locale ?: $this->getFallbackLocale(); |
|
| 338 | ||
| 339 | foreach ($this->translations as $translation) { |
|
| 340 | ||
| 341 | $translation->setRelation('parent', $this); |
|
| 342 | ||
| 343 | if ($translation->getAttribute($this->getLocaleKey()) == $locale) { |
|
| 344 | return true; |
|
| 345 | } |
|
| 346 | } |
|
| 347 | ||
| 348 | return false; |
|
| 349 | } |
|
| @@ 547-554 (lines=8) @@ | ||
| 544 | ||
| 545 | private function getTranslationByLocaleKey($key) |
|
| 546 | { |
|
| 547 | foreach ($this->translations as $translation) { |
|
| 548 | ||
| 549 | $translation->setRelation('parent', $this); |
|
| 550 | ||
| 551 | if ($translation->getAttribute($this->getLocaleKey()) == $key) { |
|
| 552 | return $translation; |
|
| 553 | } |
|
| 554 | } |
|
| 555 | ||
| 556 | return null; |
|
| 557 | } |
|