diff --git a/src/FieldServiceProvider.php b/src/FieldServiceProvider.php index 11ee736..47cd56c 100644 --- a/src/FieldServiceProvider.php +++ b/src/FieldServiceProvider.php @@ -76,10 +76,11 @@ public function boot() }); $this->fillUsing(function ($request, $model, $attribute, $requestAttribute) { - $realAttribute = $this->meta['translatable']['original_attribute']; + $realAttribute = $this->meta['translatable']['original_attribute'] ?? $attribute; $value = $request->{$realAttribute}; $translations = is_string($value) ? (array) json_decode($value) : $value; - $model->setTranslations($realAttribute, $translations); + if (method_exists($model, 'setTranslations')) $model->setTranslations($realAttribute, $translations); + else $model->{$realAttribute} = $translations; }); return $this;