diff --git a/app/Models/Website/AboutMe.php b/app/Models/Website/AboutMe.php index 111410a..4f4fac7 100644 --- a/app/Models/Website/AboutMe.php +++ b/app/Models/Website/AboutMe.php @@ -25,6 +25,9 @@ public function translations() */ public function getTranslation($locale) { + if ($this->relationLoaded('translations')) { + return $this->translations->firstWhere('locale', $locale); + } return $this->translations()->where('locale', $locale)->first(); } diff --git a/app/Models/Website/Service.php b/app/Models/Website/Service.php index a638baa..9f8193b 100644 --- a/app/Models/Website/Service.php +++ b/app/Models/Website/Service.php @@ -25,6 +25,9 @@ public function translations() */ public function getTranslation($locale) { + if ($this->relationLoaded('translations')) { + return $this->translations->firstWhere('locale', $locale); + } return $this->translations()->where('locale', $locale)->first(); } diff --git a/app/Models/Website/Skill.php b/app/Models/Website/Skill.php index e3494d0..2caa13d 100644 --- a/app/Models/Website/Skill.php +++ b/app/Models/Website/Skill.php @@ -33,6 +33,9 @@ public function translations() */ public function getTranslation($locale) { + if ($this->relationLoaded('translations')) { + return $this->translations->firstWhere('locale', $locale); + } return $this->translations()->where('locale', $locale)->first(); }