1.3: fix N+1 in getTranslation by using eager-loaded collection
Deploy Backend / deploy (push) Successful in 5m43s
Deploy Backend / deploy (push) Successful in 5m43s
This commit is contained in:
1 parent
299a98d506
commit
75af8220a7
3 files changed
+9
No files matched your search
@@ -25,6 +25,9 @@ class AboutMe extends Model
|
||||
*/
|
||||
public function getTranslation($locale)
|
||||
{
|
||||
if ($this->relationLoaded('translations')) {
|
||||
return $this->translations->firstWhere('locale', $locale);
|
||||
}
|
||||
return $this->translations()->where('locale', $locale)->first();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ class Service extends Model
|
||||
*/
|
||||
public function getTranslation($locale)
|
||||
{
|
||||
if ($this->relationLoaded('translations')) {
|
||||
return $this->translations->firstWhere('locale', $locale);
|
||||
}
|
||||
return $this->translations()->where('locale', $locale)->first();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ class Skill extends Model
|
||||
*/
|
||||
public function getTranslation($locale)
|
||||
{
|
||||
if ($this->relationLoaded('translations')) {
|
||||
return $this->translations->firstWhere('locale', $locale);
|
||||
}
|
||||
return $this->translations()->where('locale', $locale)->first();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user