From d911b2f6dedfcc77917e62e202f1bc4ea3844890 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 12 Jun 2019 17:09:52 +0200 Subject: [PATCH] #2810 --- src/app/Magic/Fields/SelectFromModel.php | 9 ++++++++- src/app/Magic/Models/CubistMagicAbstractModel.php | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/Magic/Fields/SelectFromModel.php b/src/app/Magic/Fields/SelectFromModel.php index 5bbce1c..6885ea2 100644 --- a/src/app/Magic/Fields/SelectFromModel.php +++ b/src/app/Magic/Fields/SelectFromModel.php @@ -26,9 +26,16 @@ class SelectFromModel extends Model } if ($this->getAttribute('allows_multiple')) { - $this->setAttribute('cast', 'json'); + $this->setAttribute('cast', 'array'); } parent::_postSetAttributes(); } + + public function getColumnData() + { + $res = parent::getColumnData(); + $res['options'] = $this->getAttribute('options'); + return $res; + } } diff --git a/src/app/Magic/Models/CubistMagicAbstractModel.php b/src/app/Magic/Models/CubistMagicAbstractModel.php index 7e66ebe..282370c 100644 --- a/src/app/Magic/Models/CubistMagicAbstractModel.php +++ b/src/app/Magic/Models/CubistMagicAbstractModel.php @@ -211,11 +211,13 @@ class CubistMagicAbstractModel extends Model implements HasMedia $this->translatable[] = $name; } if ($field->getAttribute('cast', false) !== false) { - $this->casts[$field->getAttribute('name')] = $field->getAttribute('name'); + $this->casts[$field->getAttribute('name')] = $field->getAttribute('cast'); } } + + } /** -- 2.39.5