From: Vincent Vanwaelscappel Date: Wed, 12 Jun 2019 15:09:52 +0000 (+0200) Subject: #2810 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=d911b2f6dedfcc77917e62e202f1bc4ea3844890;p=cubist_cms-back.git #2810 --- 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'); } } + + } /**