Skip to content

Commit 1fba782

Browse files
author
Tihomir Banov
committed
Translate response null fix
1 parent 5189753 commit 1fba782

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Despark/LaravelDbLocalization/i18nModelTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function getLocaleField()
4040
*/
4141
public function getTranslatorField()
4242
{
43-
return $this->translatedAttributes;
43+
return $this->translatorField;
4444
}
4545

4646
/**
@@ -51,7 +51,7 @@ public function getTranslatorField()
5151
*/
5252
public function getTranslatedAttributes()
5353
{
54-
return $this->translatorField;
54+
return $this->translatedAttributes;
5555
}
5656

5757
/**
@@ -79,7 +79,7 @@ public function getI18nId($locale = null)
7979
*
8080
* @param null $locale
8181
*/
82-
public function translate($locale = null)
82+
public function translate($locale = false)
8383
{
8484
$translationModel = new $this->translator();
8585

@@ -89,7 +89,7 @@ public function translate($locale = null)
8989

9090
$translation = null;
9191

92-
if (isset($this->id)) {
92+
if (isset($this->id) && !$locale) {
9393
$translation = $translationModel::where($this->translatorField, $this->id)
9494
->where($this->localeField, $locale)->first();
9595
}

0 commit comments

Comments
 (0)