diff --git a/src/TranslatableFieldMixin.php b/src/TranslatableFieldMixin.php index 7c0b8fc..3526c76 100644 --- a/src/TranslatableFieldMixin.php +++ b/src/TranslatableFieldMixin.php @@ -3,6 +3,7 @@ namespace Outl1ne\NovaTranslatable; use Exception; +use Illuminate\Contracts\Support\Arrayable; use Illuminate\Support\Arr; use Laravel\Nova\Fields\Markdown; use Laravel\Nova\Fields\Textarea; @@ -44,7 +45,11 @@ public function translatable() try { if (!is_array($value)) { if (is_object($value)) { - $value = (array) $value; + if($value instanceof Arrayable) { + $value = $value->toArray(); + } else { + $value = (array) $value; + } } else { $testValue = json_decode($value, true); if (is_array($testValue)) $value = $testValue;