Fix di forma

This commit is contained in:
FabioL 2024-03-07 09:27:22 +01:00
parent a5c8bdf718
commit 0294d0aa87
1 changed files with 4 additions and 2 deletions

View File

@ -359,7 +359,9 @@ class Articolo extends Model
*/ */
public function setNameAttribute($value) public function setNameAttribute($value)
{ {
$translated = database()->table($this->table.'_lang') $table = database()->table($this->table.'_lang');
$translated = $table
->where('id_record', '=', $this->id) ->where('id_record', '=', $this->id)
->where('id_lang', '=', setting('Lingua')); ->where('id_lang', '=', setting('Lingua'));
@ -368,7 +370,7 @@ class Articolo extends Model
'name' => $value 'name' => $value
]); ]);
} else { } else {
$translated->insert([ $table->insert([
'id_record' => $this->id, 'id_record' => $this->id,
'id_lang' => setting('Lingua'), 'id_lang' => setting('Lingua'),
'name' => $value 'name' => $value