thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.77k stars 2.67k forks source link

Translatable ignore casts #4319

Open MordiSacks opened 5 years ago

MordiSacks commented 5 years ago

Version information

Description

Translatable trait does not handle casts If we have a column that has a casts set for it, it is not casted after translation is loaded

Steps To Reproduce

Steps to reproduce the behavior:

  1. create a model with at least one text field.
  2. set protected $casts = ['field' => 'array']; on the model.
  3. add use Translatable; trait.
  4. Translate model $model = $model->translate(app()->getLocale(), 'en').

Expected behavior

dd($model->field), expected array, received string.

I will try to PR this.

stanislavhannes commented 4 years ago

+1

Any idea for a workaround?