From 11e4482d0aa81dbb690425b20e176e7ca0202a5f Mon Sep 17 00:00:00 2001 From: FabioL <1647128+loviuz@users.noreply.github.com> Date: Mon, 25 Mar 2024 12:32:22 +0100 Subject: [PATCH] Fix lettura lingue da tradurre --- src/Traits/RecordTrait.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Traits/RecordTrait.php b/src/Traits/RecordTrait.php index e111a5181..16e2e020b 100755 --- a/src/Traits/RecordTrait.php +++ b/src/Traits/RecordTrait.php @@ -73,10 +73,11 @@ trait RecordTrait */ public function save(array $options = []) { - if ($this->id) { + if ($this->id && method_exists($this, 'getTranslatedFields')) { // Lingue aggiuntive disponibili - $langs = Locale::All()->toArray(); - $other_langs = array_diff($langs, [Locale::getDefault()->id]); + $langs = Locale::All()->pluck('id')->toArray(); + $default_lang = Locale::getDefault(); + $other_langs = array_diff($langs, [$default_lang->id]); // Popolo inizialmente i campi traducibili o allineo quelli uguali foreach ($this->getTranslatedFields() as $field) {