Skip to content

Commit 8c84b02

Browse files
authored
Merge pull request #198 from Astrotomic/fix-private-to-protected
make all private methods protected
2 parents 977f873 + d97404e commit 8c84b02

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Translatable/Traits/Relationship.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function translation(): HasOne
6868
->where($this->getLocaleKey(), $this->localeOrFallback());
6969
}
7070

71-
private function localeOrFallback()
71+
protected function localeOrFallback()
7272
{
7373
return $this->useFallback() && ! $this->translations()->where($this->getLocaleKey(), $this->locale())->exists()
7474
? $this->getFallbackLocale()

src/Translatable/Traits/Scopes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function scopeWithTranslation(Builder $query)
123123
]);
124124
}
125125

126-
private function getTranslationsTable(): string
126+
protected function getTranslationsTable(): string
127127
{
128128
return app()->make($this->getTranslationModelName())->getTable();
129129
}

src/Translatable/Translatable.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ protected function saveTranslations(): bool
381381
return $saved;
382382
}
383383

384-
private function getAttributeAndLocale(string $key): array
384+
protected function getAttributeAndLocale(string $key): array
385385
{
386386
if (Str::contains($key, ':')) {
387387
return explode(':', $key);
@@ -390,7 +390,7 @@ private function getAttributeAndLocale(string $key): array
390390
return [$key, $this->locale()];
391391
}
392392

393-
private function getAttributeOrFallback(?string $locale, string $attribute)
393+
protected function getAttributeOrFallback(?string $locale, string $attribute)
394394
{
395395
$translation = $this->getTranslation($locale);
396396

@@ -411,7 +411,7 @@ private function getAttributeOrFallback(?string $locale, string $attribute)
411411
return null;
412412
}
413413

414-
private function getFallbackLocale(?string $locale = null): ?string
414+
protected function getFallbackLocale(?string $locale = null): ?string
415415
{
416416
if ($locale && $this->getLocalesHelper()->isLocaleCountryBased($locale)) {
417417
if ($fallback = $this->getLocalesHelper()->getLanguageFromCountryBasedLocale($locale)) {
@@ -422,7 +422,7 @@ private function getFallbackLocale(?string $locale = null): ?string
422422
return config('translatable.fallback_locale');
423423
}
424424

425-
private function getTranslationByLocaleKey(string $key): ?Model
425+
protected function getTranslationByLocaleKey(string $key): ?Model
426426
{
427427
if (
428428
$this->relationLoaded('translation')
@@ -435,12 +435,12 @@ private function getTranslationByLocaleKey(string $key): ?Model
435435
return $this->translations->firstWhere($this->getLocaleKey(), $key);
436436
}
437437

438-
private function toArrayAlwaysLoadsTranslations(): bool
438+
protected function toArrayAlwaysLoadsTranslations(): bool
439439
{
440440
return config('translatable.to_array_always_loads_translations', true);
441441
}
442442

443-
private function useFallback(): bool
443+
protected function useFallback(): bool
444444
{
445445
if (isset($this->useTranslationFallback) && is_bool($this->useTranslationFallback)) {
446446
return $this->useTranslationFallback;
@@ -449,7 +449,7 @@ private function useFallback(): bool
449449
return (bool) config('translatable.use_fallback');
450450
}
451451

452-
private function usePropertyFallback(): bool
452+
protected function usePropertyFallback(): bool
453453
{
454454
return $this->useFallback() && config('translatable.use_property_fallback', false);
455455
}

0 commit comments

Comments
 (0)