Open matteocastiglioni opened 6 years ago
After digging a little deeper i've found that the error occur only with named forms. In the getModelValueAttribute function, the model is seen as an array and the values of the translated fields are extracted as array.
Hi @kristijanhusak, thanks for your work with this package! It's awesome!
I'm using https://github.com/spatie/laravel-translatable to make eloquent models translatable. Translations are stored as json. Once the translatable trait is added on model, the field values are retrieved automatically based on the current app language.
When i try to repopulate an edit form, i get the following error
as a very quick fix i've edited the function setValue in Kris\LaravelFormBuilder\Fields adding the following check
if (is_array($value)) $value = isset($value[app()->getLocale()]) ? $value[app()->getLocale()] : ''
Is it possible to make the package take into consideration the translatable trait when the field values are extracted?
Laravel framework 5.6.33 Laravel form builder 1.15.1